0
Anderson Lima

Where is the current clock being stored on a RTC-less system

Recommended Posts

Armbianmonitor:

Hi all, everytime I turn on my Nano Pi it will sync the clock using NTP. When network is not enabled it will rewind the time to something that I still can't comprehend. I found lots of topics about people talking about how to add a RTC to the system, but none talking about the current RTC that is recognized by the kernel. Currently when the system is powered off and on (10 seconds distance) without network the time will rewind between 5 and 15 minutes. I understand that this happens because there is no RTC to write the current clock and battery to keep it. But there is obviously a RTC somewhere because removing power from the device and putting it back will keep a wrong but close time. I didn't leave it a long time off to check what happens yet.

 

[ 4.381725] sun6i-rtc 1f00000.rtc: registered as rtc0

[ 4.381738] sun6i-rtc 1f00000.rtc: RTC enabled

 

My question is: is it possible to sync the time more often so in a restart scenario the clock is "less wrong" ?

Share this post


Link to post
Share on other sites

You could use ntpdate and a cronjob to force an update every x minutes but I have my doubts that this would help in this case.

Share this post


Link to post
Share on other sites

Thanks for the reply. The device is installed in an place where there are power outages that affect also the network infrastructure, it can take several minutes before it goes back online. I will check if forcing ntp before a reboot makes the clock come back with the same date from the NTP.

Share this post


Link to post
Share on other sites

A bit of HW details. H3 and most of AW SoCs for that matter have RTC integrated in which can be clocked from internal or external clock. Internal clock is sadly inaccurate, so it's borderline useable for keeping time, but some boards, like NanoPi NEO still omit external clock (price consideration, I guess). So, main issue about RTC to keep time is if it has separate power supply which is still enabled when main power supply is disconnected. On schematic, this is VCC_RTC. As you can see on NanoPi NEO schematic, RTC and main power supply are connected together, so RTC will lost power and with that time every time main power supply is disconnected.

Share this post


Link to post
Share on other sites
(edited)
On 6/16/2020 at 2:01 AM, Anderson Lima said:
Armbianmonitor:

Hi all, everytime I turn on my Nano Pi it will sync the clock using NTP. When network is not enabled it will rewind the time to something that I still can't comprehend. I found lots of topics about people talking about how to add a RTC to the system, but none talking about the current RTC that is recognized by the kernel. Currently when the system is powered off and on (10 seconds distance) without network the time will rewind between 5 and 15 minutes. I understand that this happens because there is no RTC to write the current clock and battery to keep it. But there is obviously a RTC somewhere because removing power from the device and putting it back will keep a wrong but close time. I didn't leave it a long time off to check what happens yet.

 

[ 4.381725] sun6i-rtc 1f00000.rtc: registered as rtc0

[ 4.381738] sun6i-rtc 1f00000.rtc: RTC enabled

 

My question is: is it possible to sync the time more often so in a restart scenario the clock is "less wrong" ?

Do a fake-hwclock save as /etc/cron.daily/fake-hwclock at your requested interval. Chrony enables kernel mode (11 minute sync) by default (rtcsync). In a proper restart scenario fake-hwclock should handle stuff properly. (see /etc/fake-hwclock.data)

Edited by xwiggen

Share this post


Link to post
Share on other sites
22 hours ago, jernej said:

A bit of HW details. H3 and most of AW SoCs for that matter have RTC integrated in which can be clocked from internal or external clock. Internal clock is sadly inaccurate, so it's borderline useable for keeping time, but some boards, like NanoPi NEO still omit external clock (price consideration, I guess). So, main issue about RTC to keep time is if it has separate power supply which is still enabled when main power supply is disconnected. On schematic, this is VCC_RTC. As you can see on NanoPi NEO schematic, RTC and main power supply are connected together, so RTC will lost power and with that time every time main power supply is disconnected.

 

Thanks a lot, this was really useful.

 

3 hours ago, xwiggen said:

Do a fake-hwclock save as /etc/cron.daily/fake-hwclock at your requested interval. Chrony enables kernel mode (11 minute sync) by default (rtcsync). In a proper restart scenario fake-hwclock should handle stuff properly. (see /etc/fake-hwclock.data)

Thanks too, I'm trying that.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0