MeterLogger
Macros | Functions
sntp.h File Reference
#include "os_type.h"
#include "lwip/ip_addr.h"
Include dependency graph for sntp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define sntp_servermode_dhcp(x)
 

Functions

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)
 

Macro Definition Documentation

◆ sntp_servermode_dhcp

#define sntp_servermode_dhcp (   x)

Definition at line 66 of file sntp.h.

Function Documentation

◆ sntp_get_current_timestamp()

uint32 sntp_get_current_timestamp ( )

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

◆ sntp_get_real_time()

char* sntp_get_real_time ( long  t)

get real time (GTM + 8 time zone)

◆ sntp_get_timezone()

sint8 sntp_get_timezone ( void  )

SNTP get time_zone default GMT + 8

◆ sntp_getserver()

ip_addr_t sntp_getserver ( unsigned char  idx)

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

Parameters
numdnsthe index of the NTP server
Returns
IP address of the indexed NTP server or "ip_addr_any" if the NTP server has not been configured by address (or at all).

◆ sntp_getservername()

char* sntp_getservername ( unsigned char  idx)

Obtain one of the currently configured by name NTP servers.

Parameters
numdnsthe index of the NTP server
Returns
IP address of the indexed NTP server or NULL if the NTP server has not been configured by name (or at all)

◆ sntp_init()

void sntp_init ( void  )

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

◆ sntp_set_timezone()

bool sntp_set_timezone ( sint8  timezone)

SNTP set time_zone (default GMT + 8)

◆ sntp_setserver()

void sntp_setserver ( unsigned char  idx,
ip_addr_t addr 
)

Initialize one of the NTP servers by IP address

Parameters
numdnsthe index of the NTP server to set must be < SNTP_MAX_SERVERS
dnsserverIP address of the NTP server to set

◆ sntp_setservername()

void sntp_setservername ( unsigned char  idx,
char *  server 
)

Initialize one of the NTP servers by name

Parameters
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

◆ sntp_stop()

void sntp_stop ( void  )

Stop this module.