Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 15834 - hwclock --systohc on halt is bad idea
Summary: hwclock --systohc on halt is bad idea
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Reported: 2003-02-17 05:01 UTC by Stanislav Brabec
Modified: 2004-10-15 22:45 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

modified clock initscript (clock,2.03 KB, text/plain)
2004-03-27 21:33 UTC, Jonathan Rogers
Patch against standard clock initscript to avoid setting hw clock (clock.diff,422 bytes, patch)
2004-03-27 21:37 UTC, Jonathan Rogers
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Brabec 2003-02-17 05:01:00 UTC
I have checked, why my Gentoo Linux box clock was 15 minutes late after only 2
months from last hwclock calibration. I found, that on every halt the system
clock is copied to hwclock.

In theory, system clock should be more acurrate than hwclock, but in practice
there are too many situation of system high load, when system clock are not
running properly.

Reproducible: Sometimes
Steps to Reproduce:

Expected Results:  
Adjusting clock at startup, but don't touch clock on halt.

Make calls of hwclock --adjust on boot (make it optional for case of
multiple-boot system), and probably also regullarly (for example every day or week).

Optionally make calls of hwclock --hctosys on boot (it's not needed for most
systems) and also regular (For example every scan on my old ISA SCSI card was
drifted system clock by 20 seconds. I was added it to crontab every two hours.).
Comment 1 SpanKY gentoo-dev 2003-02-17 12:45:37 UTC
so why not just use ntp, it'll fix these kind of problems
Comment 2 Stanislav Brabec 2003-02-17 12:57:21 UTC
Dial-up machine - dialing only for ntp sync will be too expensive. Gentoo should be able to have acurrate time even as standalone box without net connection.
Comment 3 SpanKY gentoo-dev 2003-02-17 13:01:00 UTC
fair enough
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2003-02-17 14:29:55 UTC
It is pretty standard practice for most distro, and I guess a more expected
behaviour.  What you want is more complexity than needed for the standard
user, and is very system specific.

I am however open to a good generic solution if you want to take a stab at it.
To be honest, current works good for most user, and I just do not have the time
to get to this in a while.
Comment 5 Stanislav Brabec 2003-02-18 05:01:07 UTC
OK. Trivial solution:

Remove everything in /etc/init.d/clock in stop() section and keep there only stub (eend 0 ; return 0). It solves problems with hwclock acurracy.

I have looked at SuSE's /etc/init.d/boot.clock and it also doesn't anything with clock on halt.
Comment 6 Andrew Cooks (RETIRED) gentoo-dev 2003-10-07 00:29:25 UTC
Wouldn't it be better to move all clock configuration to /etc/conf.d/clock,
removing the lines from /etc/rc.conf and include an option to sync_on_shutdown?

Comment 7 Jonathan Rogers 2004-03-27 21:33:31 UTC
Created attachment 28189 [details]
modified clock initscript

Here is a modified "clock" initscript. I also do not want hwclock to set the
hardware clock on shutdown. In my case, it's because I want chrony (an NTP
daemon) to handle things. My script simply checks for a value in ${SYNC_HW} in
/etc/conf.d/clock. If the variable doesn't have a value, it skips setting the
hardware clock.
Comment 8 Jonathan Rogers 2004-03-27 21:37:17 UTC
Created attachment 28190 [details, diff]
Patch against standard clock initscript to avoid setting hw clock

Come to think of it, a patch would be better.
Comment 9 Matthew Schulkind 2004-08-20 23:47:39 UTC
This seems fairly safe and useful. Could this be applied?
Comment 10 SpanKY gentoo-dev 2004-10-15 22:45:07 UTC
fixed in cvs, will be in baselayout 1.11.3+