The SNTP (Simple Network Time Protocol) client service allows a user application to obtain a timestamp from a remote NTP server.
The client implements SNTP Version 4 defined by RFC4330.
After the SNTP client is initialized by calling the fnet_sntp_init() function, the user application should call the main service-polling function fnet_service_poll() periodically in background.
The obtained timestamp will be passed to the fnet_sntp_callback_resolved_t callback function, which is set during the SNTP-client service initialization.
The SNTP client service is released automatically as soon as the requested timestamp obtained or an error occurs. Your application code may continue to call fnet_service_poll() to handle other services, but this will not have any impact on the SNTP client communication until you initialize the next timestamp obtaining by calling fnet_sntp_init() again.
For the SNTP-client service example, refer to the FNET Shell demo source code.
- Note
- Current version of the SNTP client:
- can process only one request at a time.
- support unicast addressing mode. It does not support broadcast or multicast addressing mode.
Configuration parameters:
|
struct | fnet_sntp_timestamp_t |
| SNTP timestamp (RFC4330) is represented as a 64-bit unsigned fixed-point number, in seconds relative to 0h on 1 January 1900. The integer part is in the first 32 bits, and the fraction part in the last 32 bits. The maximum number that can be represented is 4,294,967,295 seconds with a precision of about 232 picoseconds. More...
|
|
struct | fnet_sntp_utc_t |
| Coordinated Universal Time (UTC) type. More...
|
|
struct | fnet_sntp_params_t |
| Initialization parameters for the fnet_sntp_init() function. More...
|
|