Subject: Re: [PATCH 2/3] powermac: proper time of day after resume

From: Gabriel Paubert <[email-masked]>
Date: Wed, 24 Jan 2007 09:54:20 +0100

On Wed, Jan 24, 2007 at 05:34:04PM +1100, Benjamin Herrenschmidt wrote:
> On Wed, 2006-12-13 at 13:38 +0100, Johannes Berg wrote:
> > plain text document attachment (time-resume.patch)
> > This patch converts the time restore code from a PMU notifier to a regular
> > sys device so I can profit from it even when I don't suspend through the
> > PMU, i.e. suspend to disk.
> > 
> > Also another step towards dropping pmu_sleep_notifier completely.
> 
> I'd rather do it differently: On suspend, read the RTC and save the
> value. On resume, read it again, diff the values, and add that to the
> current time.
> 

Isn't there a way to obtain a better resolution? 

The RTC has a resolution on 1 second AFAIR. This means that there will
be an error of up to 1 second after resume. If you run NTP, it will
ultimately be corrected (I believe) but it may take a fairly long time
given the loop bandwidth of NTP, which will also probably write for a
while crap values into its drift file (/var/lib/ntp/ntp.drift on Debian 
but location varies with distribution).

	Regards,
	Gabriel