[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: hwclock can cause system lockup

Todd Denniston <Todd.Denniston <at> ssa.crane.navy.mil> writes:
> 1) you don't need to call hwclock while NTP is running to keep the hardware 
> clock synced to system time, the kernel hackers "helpfully" put a sneak 
> circuit in the ntp implementation in the _kernel_ such that if NTP declares a 
> good sync with the external source, then the kernel will every 11 minutes 
> write the system time to the hardware clock.
> 2) (1) messes up /etc/adjtime in two ways
> 	a) the bios time has been set independent of the hwclock use of /etc/adjtime, 
> so the time since last set is wrong.
> 	b) because of (a) the amount the clock needs adjusted for drift each time 
> hwclock --adjust is called is now wrong.
> You can kind of work around the problem by having your script that calls 
> hwclock -systohc monitor either the adjtime drift or ntp's connectedness to a 
> real server and keep the drift the same while ntp has sync, i.e, have the 
> script keep the original adjtime drift if either the call is being made when 
> ntp is known to be synced or the drift changes too much towards 0.
> I have toyed with the idea of trimming that out* of my kernels, but it would 
> mean a recompile every time a kernel update happened.
> *or at least making it some kind of boot configurable item, and try to get 
> that patch in the kernel tree.

Why don't you just use the ntpd local clock driver?  The Fedora /etc/ntp.conf
has the following lines commented out:

#server     # local clock
#fudge stratum 10  

Uncommenting those causes ntpd to use the local hardware clock as a backup time
source.  ntpd will keep track of the drift and record it in the drift file to
use when starting.  It should keep fairly accurate time as long as it
occasionally is connected to the network.

 - Ian

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]