ESP8266 Centre + NB
宏定义 | 函数
sntp.h 文件参考
#include "os_type.h"
#include "ip_addr.h"
sntp.h 的引用(Include)关系图:

浏览源代码.

宏定义

#define sntp_servermode_dhcp(x)
 

函数

uint32 sntp_get_current_timestamp ()
 
char * sntp_get_real_time (long t)
 
sint8 sntp_get_timezone (void)
 
bool sntp_set_timezone (sint8 timezone)
 
void sntp_init (void)
 
void sntp_stop (void)
 
void sntp_setserver (unsigned char idx, ip_addr_t *addr)
 
ip_addr_t sntp_getserver (unsigned char idx)
 
void sntp_setservername (unsigned char idx, char *server)
 
char * sntp_getservername (unsigned char idx)
 

宏定义说明

#define sntp_servermode_dhcp (   x)

函数说明

uint32 sntp_get_current_timestamp ( )

get the seconds since Jan 01, 1970, 00:00 (GMT + 8)

char* sntp_get_real_time ( long  t)

get real time (GTM + 8 time zone)

sint8 sntp_get_timezone ( void  )

SNTP get time_zone default GMT + 8

bool sntp_set_timezone ( sint8  timezone)

SNTP set time_zone (default GMT + 8)

void sntp_init ( void  )

Initialize this module. Send out request instantly or after SNTP_STARTUP_DELAY(_FUNC).

void sntp_stop ( void  )

Stop this module.

void sntp_setserver ( unsigned char  idx,
ip_addr_t addr 
)

Initialize one of the NTP servers by IP address

参数
numdnsthe index of the NTP server to set must be < SNTP_MAX_SERVERS
dnsserverIP address of the NTP server to set
ip_addr_t sntp_getserver ( unsigned char  idx)

Obtain one of the currently configured by IP address (or DHCP) NTP servers

参数
numdnsthe index of the NTP server
返回
IP address of the indexed NTP server or "ip_addr_any" if the NTP server has not been configured by address (or at all).
void sntp_setservername ( unsigned char  idx,
char *  server 
)

Initialize one of the NTP servers by name

参数
numdnsthe index of the NTP server to set must be < SNTP_MAX_SERVERS,now sdk support SNTP_MAX_SERVERS = 3
dnsserverDNS name of the NTP server to set, to be resolved at contact time
char* sntp_getservername ( unsigned char  idx)

Obtain one of the currently configured by name NTP servers.

参数
numdnsthe index of the NTP server
返回
IP address of the indexed NTP server or NULL if the NTP server has not been configured by name (or at all)