IoT Platform provides the Network Time Protocol (NTP) service for embedded devices that have limited resources. This allows the devices to obtain accurate clocks in real time. You can configure Link SDK for C to obtain the current UTC time on the device.
Prerequisites
- The device authentication information is obtained.
- Link SDK for C is obtained.
When you customize an SDK on the SDK customization page, set Advanced Capabilities to Time Synchronization.
- A development environment is prepared.
Background information
IoT Platform provides the NTP service. For more information, see NTP service.
Process
The application program calls the API operations of Link SDK for C to connect with IoT Platform over MQTT and obtain the standard UTC time.
The following figure shows the process. In this example, the .demos/ntp_posix_demo.c application program is used.
For more information about NTP service-specific API operations, see aiot_ntp_api.h.
Examples
- For more information about examples, see Example.
- For more information about error codes, see aiot_ntp_api.h..