Re: [chrony-dev] Wake from sleep on OS X |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] Wake from sleep on OS X
- From: Bryan Christianson <bryan@xxxxxxxxxxxxx>
- Date: Wed, 2 Dec 2015 09:39:30 +1300
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=a0-2; h=Feedback-ID:X-Smtpcorp-Track:To:Message-Id:Date: From:Subject; bh=U187luCo3T1hH2YrQ8zdIZjBuFyZFWEdzMUQCfsAOmg=; b=sBPOdZQiVCVv DJFQ+16i6RcUEmo0HTgzBr99G0fyVGv1c1W2mGqXOjfMwymzF42Rxs/6AMNYSdxCw6WDWBsI2pnE4 m1ubtwHCbdvdkbUb8BaojuPqjSwnAVUpkBnFzQLYT5OEP9Mmk+VvEnM999rfY6sV2JbiBbLy9TQbi wA31Bf6i6lKVZKqjJozwNLBhzmBn8+BdMu1HEifEk0oF95CRhMQJk2mCpTdQjpdrudxySyOFZEHGm Kk3Y3afzpB6NIguafEHThSiJalbIbm+CvJVeaMFfKxhTfgZMvF2vnqbXo/MnqaY9qI8+ZP7x44aLn CGO6XYvcZ6mgJaw/6HwLTw==;
- Feedback-id: 149811m:149811acx33YQ:149811sT3zs2fOqZ:SMTPCORP
> On 2/12/2015, at 1:22 AM, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
>
> 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?
pacemaker is no longer used - I think that was a one time experiment, although Apple ntpd will still use it if it is configured on the system. The binary is no longer present.
>>
>> 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.
I just checked Apples patched version of ntp (from OSX 10.10)
They detect sleep/wakeup events via a signal handler. At each iteration of their event loop they check for either sleep or wakeup events. Sleep events are ignored and wakeup events go through a similar restart process that you describe, stepping the time if required.
Maybe the log message in chrony could indicate that the step is as a result of the wakeup event. Or we could just leave it as is.
As for keeping the RTC clock in sync, ntpd appears to do this by calling settimeofday() each time it updates its stats files.
I can add a scheduled event in the Mac OS X driver to call settimeofday() at regular intervals to force the RTC update. I would think an update every 15 minutes would not be too expensive.
--
Bryan Christianson
bryan@xxxxxxxxxxxxx
--
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.