I have a single board computer (HardKernel Odroid C2) that has no builtin RTC and need an external time source on each system boot. While I have a local NTP server, I also need RTC just in case of rare power fail, that will force NTP server to reboot and loose its time as well. As time is vital for the system functioning, I built RTC using PCF8563 I2C RTC. The problem is that it needs special kernel modules to make a system usable RTC and I have to load this modules during boot process. So the system starts with incorrect time, loads modules needed and then sets the system time from RTC with a help of /etc/rc.local:
#Set system datetime from RTC logger "Starting system clock synchronization with RTC" if [ -e /dev/rtc ]; then /sbin/hwclock --hctosys fi logger "System clock synchronized to RTC"
The problem is that systemd seems to treat the period in between early boot process and clock setup as kind of "incorrect" writing no logs. I see no logs at all after system goes down and system clock setup:
Jan 5 23:20:39 tank systemd-journald: Journal stopped Jan 5 23:20:55 tank root: System clock synchronized to RTC <- this is the second logger message Jan 5 23:20:55 tank systemd: Started /etc/rc.local Compatibility. ... Jan 5 23:21:07 tank chronyd: Forward time jump detected!
Synchronizing system clock from RTC by running hwhlock --hctosys from /etc/rc.local is the suggested method by the HardKernel. But that seems totally wrong as system clearly work for some period with predefined time before it runs rc.local. So, is there are any ways to set system clock from RTC early?