Anderson Lima Posted June 16, 2020 Posted June 16, 2020 Armbianmonitor: http://ix.io/2piy 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" ?
Werner Posted June 16, 2020 Posted June 16, 2020 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.
Anderson Lima Posted June 16, 2020 Author Posted June 16, 2020 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.
MacBreaker Posted June 16, 2020 Posted June 16, 2020 @Anderson Lima I think it is much easier to connect a external RTC like a DS 1307 module like this or a DS 3231 module like this to solve the problem. It's only some cents....
Anderson Lima Posted June 16, 2020 Author Posted June 16, 2020 Thanks, yes, certainly adding extra hardware would solve the problem properly.
jernej Posted June 16, 2020 Posted June 16, 2020 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.
xwiggen Posted June 17, 2020 Posted June 17, 2020 (edited) On 6/16/2020 at 2:01 AM, Anderson Lima said: Armbianmonitor: http://ix.io/2piy 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 June 17, 2020 by xwiggen
Anderson Lima Posted June 17, 2020 Author Posted June 17, 2020 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.
Recommended Posts