I am looking for some methods to get mangOH’s RTC updated and synchronized.
How can the time be updated during boot?
Would the onboard GNSS functionality help with this? Does this API - le_pos_GetTime() - help to get the real time?
Other options - SIM or WiFi. How can we get the time info from these?
This is not a solution, but I am just trying out, getting the time from the HTTP server. I believe there is an issue with this time. This will be elapsed time from 1970 and mangOH starts from 1980. Had anyone tried this?
GNSS is one way. Assuming you are connecting to a 2G/3G/LTE network you could also use the NITZ messages and while the AT command manual says it does not support it at+ctzu seems to work in updating the RTC.
at+ctzu?
+CTZU: 1
OK
at+cclk?
+cclk: "18/08/22,10:18:18+04"
OK
Thank you Matt.
At the minute, I haven’t activated the Sim yet. So, at+cclk returns 1980…time.
Actually, I was trying the positioning service to get GNSS time. It’s not working at the minute. Going through the docs.
Pseudo code…
Connect service
GetDate
Gettime
Disconnect service
I did some experiment with the sample code that @mlw suggested.
I got the gnss enabled, GetDate() and GetTime() also working.
Then, I called the le_rtc_*** functions as per the documentation. Now the app is stuck on connecting to RTC service.
As per the documentation, le_rtc_connectService() is a blocking call. I checked the log and confirmed.
I did check that modemService is running. But it doesn’t go through this call. (checked with sandbox:false and true as well)
Am I missing something? Please suggest.
Here is the snippet of the auto generated code…
// Library initialization function.
// Will be called by the dynamic linker loader when the library is loaded. attribute((constructor)) void _timeSyncComponent_Init(void)
{
LE_DEBUG(“Initializing timeSyncComponent component library.”);
// Connect client-side IPC interfaces.
le_rtc_ConnectService();
le_pos_ConnectService();
le_posCtrl_ConnectService();
le_gnss_ConnectService();
// Register the component with the Log Daemon.
timeSyncComponent_LogSession = log_RegComponent("timeSyncComponent", &timeSyncComponent_LogLevelFilterPtr);
//Queue the COMPONENT_INIT function to be called by the event loop
event_QueueComponentInit(_timeSyncComponent_COMPONENT_INIT);