Subject: Re: todr changes to improve clock accuracy across sleeps & reboots
To: None <tech-kern@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-kern
Date: 09/07/2006 17:58:47
On Thu, Sep 07, 2006 at 11:04:31AM -0400, Perry E. Metzger wrote:
> It would be nice if, optionally, one could wait up to one second,
> spinning, for the RTC chip to turn over a fresh second before doing
> inittodr. Similarly, one would, optionally, wait up to one second
> before doing the resettodr -- that could be done with an interval
> timer controlled sleep since the system clock has high precision.

I'm not even sure if it needs to be full spinning for the inittodr case.
On resume we could read the current time from the RTC and check the RTC
again on each clock interrupt. When it just started a new second, we can
update the wall time again. I'd expect most timers to create clock
interrupts aligned to seconds. Given that both booting and restarting of
all devices currently needs more than a second here anyway, this would
be free.

Joerg