Set Linux System Date & Time on mangOH Yellow

If I use cm rtc, the date & time are correct:

root@swi-mdm9x28-wp:~# cm rtc
04 Oct 2019 18:46:56

But date is wrong:

root@swi-mdm9x28-wp:~# date
Sun Jan  6 23:10:35 -07 1980

and that is what’s being used in the syslogs:

Jan  6 23:13:17 swi-mdm9x28-wp user.warn Legato: -WRN- | cloudInterface[1476]/cloudcomp T=main | push.c PushAckCallBack() 143 | PERSISTED Failed to remove config/persisted-store.cbor
Jan  6 23:13:17 swi-mdm9x28-wp user.info Legato:  INFO | util[1516]/util T=main | signal.c Sample() 32 | RAT of signal metrics is 1
Jan  6 23:13:17 swi-mdm9x28-wp user.info Legato:  INFO | util[1516]/util T=main | signal.c Sample() 42 | GSM metrics rxLevel.-85dBm, er.0
Jan  6 23:13:17 swi-mdm9x28-wp user.info Legato:  INFO | util[1516]/util T=main | signal.c Sample() 47 | {"rat":"GSM","rxLevel":-85,"er":0}

How do I get the “system” date & time correct?

I tried:

root@swi-mdm9x28-wp:~# date -s "04 Oct 2019 18:46:56"
date: invalid date '04 Oct 2019 18:46:56'

You can set it from the host as follows:
ssh root@192.168.2.2 "date -s ‘$(date +%F)’ "

ssh root@192.168.2.2 "date -s ‘$(date +%T)’ "

Inconveniently date and cm rtc use different formats so it’s not simple to set one from the other.

is that assuming a linux host?

I’m on Windows - so what is the format that ‘date’ expects ?

Yes that’s a linux host. “date +%F” returns yyyy-mm-dd and “date +%T” returns hh:mm:ss so either of those formats work with “date -s” on the mangOH, e.g. “date -s 2019-10-04”.

You could write a script using awk or the like to set the system time from the rtc if you want it done automatically. Or probably something could be set up on the Windows host but I’m not knowledgeable about that.

If you are using leaf on a Linux then this works:
https://docs.legato.io/latest/toolsHost_settime.html

date is a busybox built-in so the busybox man-page options and args works:
https://busybox.net/downloads/BusyBox.html:
Recognized TIME formats:

    hh:mm[:ss]
    [YYYY.]MM.DD-hh:mm[:ss]
    YYYY-MM-DD hh:mm[:ss]
    [[[[[YY]YY]MM]DD]hh]mm[.ss]

Btw, the cm rtc is for the modem processor rtc. mangOH Yellow has a separate RTC for the app.
processor. By default the driver is loaded and assuming the battery is connected it should
maintain the time & update the clock on boot and do writes to hwclock @ 10 secs. ntp scripts also
exists in /etc/init.d. Also, gnss is there for the time update if you are outside.

Not at the unit at the moment.

I had seen the busybox docs, the format I tried from there didn’t wasn’t accepted when I tried it.

The date format @pinst suggested worked, but I don’t think I got the time - the mangOH seems to be working with an offset from UTC …

Thanks for the info - that gives me some stuff to work on …

Try “cat /etc/timezone” on the mangOH. Mine says:
Etc/GMT+4

which is Eastern Daylight Time. Presumably yours does not match your locale.

Method 1 on this link should work for you, the files are there.
https://www.thegeekstuff.com/2010/09/change-timezone-in-linux/

Hello,
Timezone configuration is yet another issue. For me it is unclear how that information is setup. From the network? I have 10 mangoh reds and none of them gets updated and keep on UTC time.
Tomorrow I will check if our yellow got an updated timezone.
Regards