MeterLogger
sntp.h
Go to the documentation of this file.
1 #ifndef __SNTP_H__
2 #define __SNTP_H__
3 
4 #include "os_type.h"
5 #ifdef LWIP_OPEN_SRC
6 #include "lwip/ip_addr.h"
7 #else
8 #include "ip_addr.h"
9 #endif
10 /**
11  * get the seconds since Jan 01, 1970, 00:00 (GMT + 8)
12  */
14 /**
15  * get real time (GTM + 8 time zone)
16  */
17 char* sntp_get_real_time(long t);
18 /**
19  * SNTP get time_zone default GMT + 8
20  */
22 /**
23  * SNTP set time_zone (default GMT + 8)
24  */
25 bool sntp_set_timezone(sint8 timezone);
26 /**
27  * Initialize this module.
28  * Send out request instantly or after SNTP_STARTUP_DELAY(_FUNC).
29  */
30 void sntp_init(void);
31 /**
32  * Stop this module.
33  */
34 void sntp_stop(void);
35 /**
36  * Initialize one of the NTP servers by IP address
37  *
38  * @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS
39  * @param dnsserver IP address of the NTP server to set
40  */
41 void sntp_setserver(unsigned char idx, ip_addr_t *addr);
42 /**
43  * Obtain one of the currently configured by IP address (or DHCP) NTP servers
44  *
45  * @param numdns the index of the NTP server
46  * @return IP address of the indexed NTP server or "ip_addr_any" if the NTP
47  * server has not been configured by address (or at all).
48  */
49 ip_addr_t sntp_getserver(unsigned char idx);
50 /**
51  * Initialize one of the NTP servers by name
52  *
53  * @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS,now sdk support SNTP_MAX_SERVERS = 3
54  * @param dnsserver DNS name of the NTP server to set, to be resolved at contact time
55  */
56 void sntp_setservername(unsigned char idx, char *server);
57 /**
58  * Obtain one of the currently configured by name NTP servers.
59  *
60  * @param numdns the index of the NTP server
61  * @return IP address of the indexed NTP server or NULL if the NTP
62  * server has not been configured by name (or at all)
63  */
64 char *sntp_getservername(unsigned char idx);
65 
66 #define sntp_servermode_dhcp(x)
67 
68 #endif
void sntp_init(void)
uint32 sntp_get_current_timestamp()
char * sntp_getservername(u8_t idx)
void sntp_setserver(u8_t idx, ip_addr_t *addr)
sint8 sntp_get_timezone(void)
void sntp_stop(void)
typedefPACK_STRUCT_END struct ip_addr ip_addr_t
Definition: ip_addr.h:64
unsigned int uint32
Definition: c_types.h:54
void sntp_setservername(u8_t idx, char *server)
bool sntp_set_timezone(sint8 timezone)
ip_addr_t sntp_getserver(u8_t idx)
char * sntp_get_real_time(long t)
signed char sint8
Definition: c_types.h:47