Red Hat Bugzilla – Bug 150493
hwclock --systohc sets clock 0.5 seconds slow
Last modified: 2007-11-30 17:11:01 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.3)
Description of problem:
The kernel code, when setting the BIOS clock notes that the clock time
ticks to the next second 0.5 seconds after adjusting it (see
linux/arch/i386/kernel/time.c) It looks like this was a bug fixed in
1995, but I've not checked. This is probably only actually used for
when the system time is externally synced, but I havn't checked.
hwclock --systohc sets the CMOS clock at the 1 second boundry and thus
causes the clock to be wrong by 500ms each time it is reset.
If (as is normal on FC3 at least) the clock is set every shutdown then
the clock will have a reboot-count related drift as well as the
natural drift problems of the clock. Note that this also mucks up the
drift calculations, of course.
Version-Release number of selected component (if applicable):
util-linux-2.12a-16 and earlier
Steps to Reproduce:
1.sync system clock to external timeserver
2.hwclock --systohc ; hwclock --hctosys
3.Repeat (2) another 9 times for greater visibility.
4.set system clock to external timeserver.
5.hwclock ; time +%c%N
Note the 0.5 second offset for each time (2) was done - total of about
Created attachment 111752 [details]
Change timing delay to wait for half-second rather than full second before writing to CMOS
I've hacked together this patch and it seems to work - hwclock --systohc now
sets the cmos clock to the same value the kernel does when in "11 minute mode",
as opposed to 0.5 seconds out. Obviously another set of eyes should check it!
Fedora Core 3 is now maintained by the Fedora Legacy project for security
updates only. If this problem is a security issue, please reopen and
reassign to the Fedora Legacy product. If it is not a security issue and
hasn't been resolved in the current FC5 updates or in the FC6 test
release, reopen and change the version to match.
The bug has been fixed in the util-linux-ng upstream code and will be also fixed
in FC ASAP.