108time_t
set_time(time_t time_to_set, uint32_t fraction=0);
134BOOL SetNTPTime(
IPADDR ntpserver);
146BOOL SetTimeNTPFromPool(
bool debug = FALSE);
158time_t GetNTPTime(
IPADDR NTP_server_ip, uint32_t * pFraction=0);
161#define TWELVE_HOURS_SECS (12*3600)
162#define ONE_DAY_SECS (14*3600)
185class NtpClientServlet:
public servlet,
public config_obj,
public TimeOutElement
197 servlet_list * m_pWhoToReJoin;
203 virtual int AddToSelectSet(fd_set &rd_set, fd_set &wr_set, fd_set &er_set);
204 virtual void ProcessSelectResult(fd_set &rd_set, fd_set &wr_set, fd_set &er_set);
206 virtual void TimeElementEvent();
215 NtpClientServlet(
const char* NTP_Server=
"pool.ntp.org",uint32_t update_interval_sec=TWELVE_HOURS_SECS);
225 NtpClientServlet(servlet_list * List_To_Join,
const char* NTP_Server=
"pool.ntp.org",uint32_t update_interval_sec=TWELVE_HOURS_SECS);
244 bool TimeIsCurrent();
253 bool RefreshNow(uint32_t ticks_to_wait);
262 bool WaitForValid(uint32_t ticks_to_wait);
269 inline time_t GetSecsSinceUpdate() {
return Secs-last_update; }
276 inline void SetServer(
const char* pServer) {m_server = pServer; m_ServerAddress = pServer; cur_state = 0;}
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition ipv6_addr.h:41
Lightweight alternative to C++ CString class.
Definition nbstring.h:118
Signed 32-bit Integer Configuration Variable.
Definition config_obj.h:700
Base class used to create configuration objects.
Definition config_obj.h:320
String Configuration Variable.
Definition config_obj.h:1127
void tzsetchar(const char *tzenv)
Set the system local time.
time_t timegm(struct tm *bts)
Converts a tm structure to time_t in GMT.
time_t time(time_t *pt)
Gets the current system GMT time.
time_t set_time(time_t time_to_set, uint32_t fraction=0)
Set the system time to the value passed in the time_t parameter.