Bug 865917 - Please update ntp to sync hardware RTC as soon as a time fix has been made
Summary: Please update ntp to sync hardware RTC as soon as a time fix has been made
Keywords:
Status: CLOSED DUPLICATE of bug 816752
Alias: None
Product: Fedora
Classification: Fedora
Component: ntp
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Lichvar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-12 19:43 UTC by Lennart Poettering
Modified: 2012-10-15 08:48 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-15 08:48:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Lennart Poettering 2012-10-12 19:43:55 UTC
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).

Thanks!

Comment 1 Lennart Poettering 2012-10-12 19:45:20 UTC
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).

Comment 2 Miroslav Lichvar 2012-10-15 08:48:50 UTC
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 ***


Note You need to log in before you can comment on or make changes to this bug.