Subject: Re: todr changes to improve clock accuracy across sleeps & reboots
To: None <tech-kern@netbsd.org>
From: Perry E. Metzger <perry@piermont.com>
List: tech-kern
Date: 09/09/2006 11:29:51
David Laight <david@l8s.co.uk> writes:
> On Thu, Sep 07, 2006 at 11:04:31AM -0400, Perry E. Metzger wrote:
>> 
>> Most of the battery backed up RTC chips in use have very coarse
>> precision compared to the kernel. That is, they read out only to the
>> nearest 1 second. They often have quite good accuracy, however.
>
> Some of them also have 'trim' registers that can be set to improve
> the long term accuracy.  So if the time is corrected, and you
> remembered when it was last corrected, some simple maths [1] gives
> an update for the trim register.

I was wondering about that. Garrett recently removed all our (unused)
hook based support for updating the trim registers -- maybe we should
bring that back.

> The current situation for systems not using NTP is stupid, we rewrite
> the time from a low-quality uncalibrated source (the system clock)
> over that of a device that is meant to have reasonable long term
> accuracy.

Perhaps it would be best if we only wrote back the system clock to the
battery clock if the system clock knows it is being NTP conditioned,
and otherwise conditioned the system clock based on the battery clock.

Perry