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.).
so why not just use ntp, it'll fix these kind of problems
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.
fair enough
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.
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.
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?
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.
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.
This seems fairly safe and useful. Could this be applied?
fixed in cvs, will be in baselayout 1.11.3+