Re: [chrony-dev] Wake from sleep on OS X

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Tue, Dec 01, 2015 at 10:37:49PM +1300, Bryan Christianson wrote:
> I am not sure what mechanisms are used when the kernel sleeps. I would expect the RTC to have been updated but maybe it isn't. Apple docs don't seem to cover this very well. I've been unable to find anything equivalent to hwclock to do the RTC update.

Maybe it's something ntpd or pacemaker normally do?
> 
> When chronyd wakes from sleep, won't it see the abrupt change in time as a step and start compensating for that? 

If the RTC was set to the system time before suspend, it didn't drift,
and its reading on resume was accurate, there would be no step in the
offset, only the absolute time would jump and chronyd could in most
cases go on as nothing happened.

But that's probably never the case. When a time jump is detected, the
assumption is that something was messing with the clock or the system
was suspended and the clock was reset from RTC. Old measurements are
thrown away, associations are reset and chronyd starts from scratch.
It needs 3 new measurements before it can start correcting the clock
again.

> In SCH_MainLoop(),  'saved_time' would be the time before sleep and 'now' would be the current time. This would trigger the warning from check_current_time()
> 
> I was thinking maybe the scheduler should do nothing until the system notifies that it is fully awake and then it may need to reset some internal state.

Maybe. But I'm still not sure what advantages it would have. There
could be chronyc commands to inform chronyd about the suspend/resume
to allow easy integration with system scripts etc.

> > It's not clear to me what the result should be. Faster detection of
> > the forward time jump, or faster adjustment of the clock when it's
> > detected?
> 
> I think we could be detecting a jump when there is none, just that we have inconsistent state for the first cycle on wakeup and then start compensating for differences that don't exist.

You mean some register in the driver that needs to be reset? That
could be done on the "unknown step" event.

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/