Bug 150493

Summary: hwclock --systohc sets clock 0.5 seconds slow
Product: [Fedora] Fedora Reporter: David Gardner <djgardner>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: mattdm, mlichvar, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-04-06 11:18:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Change timing delay to wait for half-second rather than full second before writing to CMOS none

Description David Gardner 2005-03-07 18:32:07 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.3)
Gecko/20041020

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

How reproducible:
Always

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
 5 seconds.

Additional info:

Comment 1 David Gardner 2005-03-07 18:38:39 UTC
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!

Comment 2 Matthew Miller 2006-07-10 22:32:06 UTC
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.

Thank you!


Comment 3 Tomas Mraz 2007-01-25 09:59:58 UTC
Still happens.

Comment 4 Karel Zak 2007-03-19 23:35:30 UTC
The bug has been fixed in the util-linux-ng upstream code and will be also fixed
in FC ASAP.