Subject: RTC and clocks
To: None <port-i386@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: port-i386
Date: 09/18/2006 20:18:19
Hi! I have a mystery. Well, sort of.
The original mystery was that "date; sleep 60; date" on my laptop would
take exactly 60 seconds, and print timestamps 35 seconds apart.
I replaced the laptop's CMOS battery, and this no longer happens.
However, in the process, I started trying to understand the i386 clock code,
and I cannot for the life of me figure out how this is possible. So far as
I can tell, the system's clock is read only at boot. At runtime, I can
imagine the system getting regular i8254 interrupts (and thus keeping good
time), or I can imagine problems (making the clock slip).
What I can't figure out is how the kernel can keep flawless time in terms
of the duration of timers (such as sleep), while still having the clock
slip.
-s