The sntp_get_time function, in unicast mode, sends a
get time request to NTP server. Parameter ipadr specifies the
IP address of NTP server, where the request is destined to.
The sntp_get_time function, in broadcast mode, opens
UDP socket for receiving broadcasted NTP messages. You can use
broadcast mode, if you have a broadcasting NTP server in your local
network. Parameter ipadr specifies the IP address of local NTP
server. The NTP messages that come from specified NTP server are
accepted, the messages that come from different NTP server are
ignored. If IP address, specified in ipadr is 0.0.0.0, NTP
messages from any NTP server are accepted.
If the IP address of NTP server is not specified (parameter
ipadr is NULL), the IP address of NTP Server configured
in Net_Config.c is used
instead.
The argument cbfunc points to a function that the SNTP
client running on TCPnet calls, when NTP message is received from the
server. The cbfunc is an event callback function that uses the
utc_time argument of the cbfunc to signal the time. The
time is specified in utc (unix time in seconds, elapsed since
1.1.1970). The value of 0 is reserved to report an error.
The sntp_get_time function is in the RL-TCPnet library. The
prototype is defined in rtl.h.
|