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

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


> On 2/12/2015, at 12:48 PM, Bill Unruh <unruh@xxxxxxxxxxxxxx> wrote:
> 
> 
> I have no idea how OSx timekeeping works. However clearly there is a way of
> setting the rtc and setting the system clock. hwclock is simply a package
> which does those things on Linux as a user runnable program. I also do not
> know what the difference is between "setting the time manually" and "run
> hwclock". hwclock is how a user sets the clock, either the system clock from
> rtc or rtc from the system clock, under linux. What is the procedure on OSx?
> Anyway as you can see I am way out of my depth here.
> 
The usual means for adjusting time in OS X is to use the System Preferences gui, either setting the time manually (I think its probably just a wrapper around the date command) or enabling ntpd. It can also be set as superuser from the command line using the 'date' command but I doubt that many people would ever do that.

The wrapper script thats is run to start ntpd uses sntp to initially set the system time and step the clock if necessary. The script then starts ntpd.

These methods will eventually issue a settimeofday() system call. I had a look in the OS X kernel and settimeofday() seems to be the only exported mechanism for updating the hardware clock.

There is no separate hwclock type of program and there is no /dev/rtc device or equivalent. I guess Apple decided it wasn't necessary because the user only has the 2 choices I outlined. I suppose one option would be to write a program that does gettimeofday()/settimeofday() to be invoked at shutdown, but thats another binary that has to be maintained, installed and activated.

I had a read of all the rtc.... directives available for the chronyd configuration and it looks to me as tho those mechanisms are only supported on Linux. 

I think the best option is periodic updates from chronyd via the settimeofday() system call. Nothing else is setting the h/ware clock and since it seems as tho rtc recovery is not supported, settimeofday() wouldn't be trading on anyones toes.

However, it does surprise me that its not automatic, especially if adjtime() has been called and the clock deliberately deviated away from the rtc setting. I had assumed this to be the case and clearly I was wrong, my clock having drifted to 6 seconds offset from NTP time.

Anyway - I am sure Miroslav will be able to help resolve this.

-- 
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.


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