clock_systohc Function

Header: #include <applibs/rtc.h>

Synchronizes the real-time clock (RTC) with the current system time. The RTC only stores the time in UTC/GMT. Therefore, conversion from local time is necessary only if the local time zone isn't GMT.

int clock_systohc(void);

Errors

Returns -1 if an error is encountered and sets errno to the error value.

  • EACCES: the caller doesn't have the SystemTime capability.

  • EBUSY: The RTC device was in use and couldn't be opened. The caller should try again periodically until it succeeds.

Any other errno may also be specified; such errors aren't deterministic and the same behavior might not be retained through system updates.

Return value

Returns 0 for success, or -1 for failure, in which case errno is set to the error value.

Application manifest requirements

This function requires the SystemTime capability in the application manifest.

Concepts and samples