Network Time Protocol (NTP) client to synchronize system time.
More...
Network Time Protocol (NTP) client to synchronize system time.
This module retrieves the current UTC time from a time server, and invokes a callback which can then update the system time.
◆ net_ntp_callback_t
Callback invoked when system time should be updated.
- Parameters
-
date | Pointer to the updated UTC time. Valid only for the duration of the callback. |
Definition at line 37 of file ntp.h.
◆ net_ntp_t
Opaque NTP manager handle.
The handle identifies the singleton NTP manager. It is valid after net_ntp_init() succeeds and remains valid until net_ntp_finalize() is called.
Definition at line 29 of file ntp.h.
◆ net_ntp_finalize()
◆ net_ntp_init()
Initialize (or re-initialize) the NTP manager.
- Parameters
-
callback | Optional callback invoked on successful time updates. |
- Returns
- A pointer to the NTP manager handle (singleton), or NULL on error.
- Examples:
- examples/runtime/ntp/main.c.
◆ net_ntp_valid()
Determine if the NTP handle is checking for time updates.
- Parameters
-
ntp | The NTP manager handle. |
- Returns
- true if initialized; false otherwise.
Returns true if the NTP manager is valid and connected. If the connection is lost, it will return false.
- Examples:
- examples/runtime/ntp/main.c.