User Timebase

API Reference
Set User Timebase how-to


This API provides definitions to read and set the user timebase for a target's real time clock (RTC).

Usually, the time daemon automatically updates the system time (i.e., gets time value when calling le_clk_GetAbsoluteTime() or using Linux date command). In some cases, the RTC time value may require a user timebase value based on other domains (e.g., GPS) to offset differences between the battery-powered RTC and the system time.

If you're synchronizng with cellular network time only, the time daemon will update the system time (the time you get when calling le_clk_GetAbsoluteTime() or using linux 'date' command) automatically.

Disable Time Daemon

If you need to set the system time from a saved user timebase value, first disable the time daemon by commenting out the TIME_SERVICES="qcom_time" line in /etc/time_service.conf to prevent the system time from being updated if the modem receives a new time from a cellular network.

Get/Set Time Value

You use le_rtc_GetUserTime() to read the current RTC time, and le_rtc_SetUserTime() to set the user timebase adjustment (plus/minus in milliseconds).

The time stored in the user timebase is incremented on a millisecond basis; Unix time is incremented by the second. When storing Unix time in the user timebase, it must be multiplied by 1000, and must be divided by 1000 when retrieved.

Typically, it's sufficient to use Unix epoch time x 1000 as the time base.