#pragma once #include #include #include class ntp { public: ntp(); virtual ~ntp(); bool get(struct tm* t); static bool get_from(const std::string& ip, struct tm* t); }; class NtpThread : public Thread { private: //同步时间失败时,重试次数 int reTry; public: static NtpThread* getInstance(void); bool readyToRun(); virtual bool threadLoop(); private: NtpThread(){ reTry = 5; } ~NtpThread(){} }; #define NTPTHREAD NtpThread::getInstance()