Bug #114: expand setclock script
spyro at f2s.com
Tue Jan 13 18:47:05 PST 2004
On Tue, 13 Jan 2004 11:44:27 -0700
Gerard Beekmans <gerard at linuxfromscratch.org> wrote:
> Ian Molton brought up some interesting information regarding accuracy of
> hardware clock vs the system clock, things about quartz crystals and
> such. I got a bit lost in the thread. Ian (or anybody else who paid
> attention to it and understands it), if you're still paying attention
> could you summarize it for me?
Im not sure the thread ever reached a consensus I agreed with (I forget) but my take in the matter is this:
The (undisciplined) system clock is not accurate. Even on systems where the system load doesnt affect its timekeeping, the clock is still driven by (ultimately) a quartz crystal in the relatively unstable thermal environment of a PC (plot the system temperature of one of your boxes - I found mine was very clearly up and down during the day and night).
A typical PCs hardware clock is really no better off, except it is (arguably) made of slightly better materials, being a dedicated clock, not just a function of the systems main oscillator. It still suffers from its environment.
The topic of the thread was wether LFS should synchronise the HWclock to the SYSclock when it is shutdown.
One case is that of a system where the sysclock might have drifted so far that on reboot it has effectively gone backwards when the sysclock is reset from the hwclock. I consider such a system broken, and disregard this case.
Another is a working system where the drift is reasonable. in this case, and since we know not which clock is better, why bother? you would be setting one unknown clock from another unknown clock. Unless you have VERY good reason to believe your hwclock is significantly more accurate, that is.
The last case is where the system clock has been not only set by, but also *disciplined* by an external clock and frequency reference. Over a long period of time, the frequency drift of the system clock can be characterised, and thus the actual time can be estimated with a significant degree of accuracy.
In this last case, it IS worth setting the hwclock, since it is entirely possible that the system clock is both more accurate, AND significantly deviated from it. it can also take a significant time to 're settle' the system after a reboot (longer the further out it is).
That said, my servers clock is only 4 seconds out over 45 days...
Spyros lair: http://www.mnementh.co.uk/ |||| Maintainer: arm26 linux
Do not meddle in the affairs of Dragons, for you are tasty and good with ketchup.
More information about the lfs-dev