Bug 150493 - hwclock --systohc sets clock 0.5 seconds slow
Summary: hwclock --systohc sets clock 0.5 seconds slow
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux
Version: rawhide
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-03-07 18:32 UTC by David Gardner
Modified: 2007-11-30 22:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-04-06 11:18:11 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Change timing delay to wait for half-second rather than full second before writing to CMOS (979 bytes, patch)
2005-03-07 18:38 UTC, David Gardner
no flags Details | Diff

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.


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