Functions#
This section provides a reference to the SNTP API functions.
Functions#
Start SNTP client.
Get the current NTP epoch time in seconds.
Get time and date information from NTP.
Get NTP server information.
Stop SNTP client.
Function Documentation#
sl_sntp_client_start#
sl_status_t sl_sntp_client_start (sl_sntp_client_config_t * config, uint32_t timeout)
Start SNTP client.
[in] | config | Valid pointer to client configuration structure of type sl_sntp_client_config_t . This shall not be null. |
[in] | timeout | Timeout for starting SNTP client. This is blocking API for timeout > 0, else results are returned in sl_sntp_client_event_handler_t callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
This API needs to be called before calling any other SNTP API
156
of file components/service/sntp/inc/sl_sntp.h
sl_sntp_client_get_time#
sl_status_t sl_sntp_client_get_time (uint8_t * data, uint16_t data_length, uint32_t timeout)
Get the current NTP epoch time in seconds.
[in] | data | Valid pointer to data buffer which should be greater than or equal to 50 bytes. In synchronous case, time is returned in this buffer in string format. In async call, this parameter is given to user in user_data parameter of event handler. |
[in] | data_length | Data buffer length. In async call, this parameter is given to user in user_data_length parameter of event handler. |
[in] | timeout | Timeout for getting time. This is blocking API for timeout > 0, else results are returned in sl_sntp_client_event_handler_t callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
167
of file components/service/sntp/inc/sl_sntp.h
sl_sntp_client_get_time_date#
sl_status_t sl_sntp_client_get_time_date (uint8_t * data, uint16_t data_length, uint32_t timeout)
Get time and date information from NTP.
[in] | data | Valid pointer to data buffer which should be greater than or equal to 50 bytes. In synchronous case, the date and time is returned in this buffer in string format. In async call, this parameter is given to user in user_data parameter of event handler. |
[in] | data_length | Data buffer length. In async call, this parameter is given to user in user_data_length parameter of event handler. |
[in] | timeout | Timeout for getting time and date. This is blocking API for timeout > 0, else results are returned in sl_sntp_client_event_handler_t callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
178
of file components/service/sntp/inc/sl_sntp.h
sl_sntp_client_get_server_info#
sl_status_t sl_sntp_client_get_server_info (sl_sntp_server_info_t * data, uint32_t timeout)
Get NTP server information.
[in] | data | Valid pointer to data buffer of type __attribute__. In async call, this parameter is given to user in user_data with its the structure size (i.e sizeof( sl_sntp_client_event_handler_t )) in user_data_length parameter of event handler. |
[in] | timeout | Timeout for getting server information. This is blocking API for timeout > 0, else results are returned in sl_sntp_client_event_handler_t callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
188
of file components/service/sntp/inc/sl_sntp.h
sl_sntp_client_stop#
sl_status_t sl_sntp_client_stop (uint32_t timeout)
Stop SNTP client.
[in] | timeout | Timeout for stop SNTP client. This is blocking API for timeout > 0, else results are returned in sl_sntp_client_event_handler_t callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
197
of file components/service/sntp/inc/sl_sntp.h