Red Hat Bugzilla – Bug 865917
Please update ntp to sync hardware RTC as soon as a time fix has been made
Last modified: 2012-10-15 04:48:50 EDT
In older Fedora versions, the system clock was synced down to the RTC at shutdown. We dropped this a while ago, since without knowledge that the system clock was accurate and in which mode the RTC clock is used (local or UTC) we shouldn't touch the RTC, and systemd generally does not have this knowledge.
Now, chrony is in a much better position to know when the system clock is accurate, as making sure of that is pretty much is job and since for that it implements NTP. As the kernel already syncs minor clock changes on its own (via the 11min mode), we'd like to see chrony sync big time jumps (i.e. the initial clock jump if there is one) to the RTC as well, so that all bases are covered.
The are multiple ways to implement this:
a) I'd recommend simply patching the ntp C code to sync big time jumps down to the RTC device. This means that big jumps are immediately reflected in the hardware, and the time correction is not lost on power failure and similar occasion. This is the cleanest and most robust solution, in my opinion.
b) hwclock -w is invoked as part of the ntp unit files at the right point in time, i.e. after big time jumps. Alternatively via a cron job/timer unit, if that's desired.
c) hwclock -w is invoked at shutdown, but this has the negative impact that time correction is lost if power is turned off abruptly or the machine otherwise dies without a clean shutdown. This behaviour comes closest to the behaviour of old Fedora, but is probably the least desirable.
Either way this logic should only be done if ntp is installed and enabled as only then the system clock is known to be accurate enough. If a) is implemented this will be the case automatically. If b)/c) is implement a nice way would be to pull the sync units if ntp is enabled, i.e. via Also= in the [Install] section of the units.
Please add a C patch to ntp for this (a), or alternatively package unit files invoking hwclock for this (b/c).
Note that this bug is probably not of highest priority since this currently only affects systems with clocks off for more than 30min, and an easy work-around exists (hwclock -w).
ntpd currently doesn't know or care about RTC, getting this upstream would be difficult. We should reach a conclusion in the bug #816752 first.
*** This bug has been marked as a duplicate of bug 816752 ***