# Set Linux System Date & Time on mangOH Yellow

**URL:** <https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965>\
**Category:** mangOH Yellow\
**Created:** [October 4, 2019, 5:58pm UTC](https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965 "2019-10-04T17:58:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![awneil](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/awneil/32/486_2.png) [@awneil](https://mangoh.discourse.group/u/awneil)\
**Post date:** [October 4, 2019, 5:58pm UTC](https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965/1 "2019-10-04T17:58:15Z")

</div>

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

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

```

But **date** is wrong:

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

```

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

```auto
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:

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

```

---

<div class="post-metadata">

**Author:** ![pinst](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@pinst](https://mangoh.discourse.group/u/pinst)\
**Post date:** [October 4, 2019, 6:48pm UTC](https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965/2 "2019-10-04T18:48:03Z")

</div>

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

ssh [root@192.168.2.2](mailto: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.

---

<div class="post-metadata">

**Author:** ![awneil](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/awneil/32/486_2.png) [@awneil](https://mangoh.discourse.group/u/awneil)\
**Post date:** [October 4, 2019, 6:51pm UTC](https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965/3 "2019-10-04T18:51:06Z")

</div>

is that assuming a linux host?

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

---

<div class="post-metadata">

**Author:** ![pinst](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@pinst](https://mangoh.discourse.group/u/pinst)\
**Post date:** [October 4, 2019, 7:00pm UTC](https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965/4 "2019-10-04T19:00:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Zahid](https://avatars.discourse-cdn.com/v4/letter/z/e79b87/32.png) [@Zahid](https://mangoh.discourse.group/u/Zahid)\
**Post date:** [October 6, 2019, 12:55am UTC](https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965/5 "2019-10-06T00:55:26Z")

</div>

If you are using leaf on a Linux then this works:  
[https://docs.legato.io/latest/toolsHost\_settime.html](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:](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.

---

<div class="post-metadata">

**Author:** ![awneil](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/awneil/32/486_2.png) [@awneil](https://mangoh.discourse.group/u/awneil)\
**Post date:** [October 7, 2019, 10:34am UTC](https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965/6 "2019-10-07T10:34:15Z")

</div>

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 …

---

<div class="post-metadata">

**Author:** ![pinst](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@pinst](https://mangoh.discourse.group/u/pinst)\
**Post date:** [October 7, 2019, 1:13pm UTC](https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965/7 "2019-10-07T13:13:50Z")

</div>

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/](https://www.thegeekstuff.com/2010/09/change-timezone-in-linux/)

---

<div class="post-metadata">

**Author:** ![epastor](https://avatars.discourse-cdn.com/v4/letter/e/91b2a8/32.png) [@epastor](https://mangoh.discourse.group/u/epastor)\
**Post date:** [October 7, 2019, 10:39pm UTC](https://mangoh.discourse.group/t/set-linux-system-date-time-on-mangoh-yellow/2965/8 "2019-10-07T22:39:29Z")

</div>

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
