Changing the kernel's tick

I'd like to find out how to change the number of miliseconds added to the system clock every tick by the kernel.

I'd also like to find a way to change the clock after waking up from a sleep. If I put my system to sleep at night, and wake it up in the morning, my clock is off, and ntp has a fit and cannot synch properly.



Mac Mini 1.42 1G Mac OS X (10.4.3)

Posted on Jan 4, 2006 2:49 PM

Reply
9 replies

Jan 4, 2006 11:05 PM in response to reese_

Mac Mini.

The offset is like half a second. Enough that it wants to correct it with a step. But after that, it wants to keep stepping, and never goes back into synch, at least with the standard apple ntp.conf file. It just keeps stepping forward, then backwards.

If I change the ntp.conf to the "normal" of just listing the server, not any minpoll/maxpoll, then it resets the timing to 64 seconds, and can synch again.

Jan 5, 2006 8:17 PM in response to keybounce

Apple's ntp.conf sets minpol to 12, which means 2**12 = 4096 seconds, or about 1 hour. As you say, setting minpol to lower value will solve your problem. But this may increase the load on the ntp server you are syncing with.

If you want to set the clock by a single step, then you can use

ntpdate -b

I guess it would be better to stop ntpd when you run ntpdate; the following will stop netpd, run ntpdate -b, and start ntpd again:

/System/Library/StartupItems/NetworkTime/NetworkTime restart



PowerMac G4 Mac OS X (10.4.3)

Jan 11, 2006 6:12 AM in response to keybounce

"ok, the first estimate we get must be accurate"


I thought this was exactly what you wanted to do, because you wrote:

The idea is that if I know how long the system was asleep for, and I know the approximate drift factor, then I can make a single step at wakeup that should cover the drift while I slept


I think ntpdate can recover most of your 'half a second' offset, and the rest of the task will be taken care of by ntpd daemon (without setting minpol to smaller value).

Does "ntpd -p" solve your problem without setting minpol to smaller value
(or setting iburst option)?

PowerMac G4 Mac OS X (10.4.3)

Mar 22, 2006 9:25 AM in response to keybounce

Alright, here's more information.

#1. Setting "iburst" has no effect that I can detect.
#2. If there is no initial drift file, ntpd assumes the drift is 0.0.
#3. When the system wakes up from a sleet, the first poll that ntpd takes will seem way off, and the clock will go "unsychronized". The second sample will be consistent with the first; ntpd will assume "accurate", and step the clock. ** It will also change the drift. It assumes that the entire overnight drift happened in about one hour, so it changes the drift from 4.5 to about 500.
#4. This means that about 3 hours after waking up, it will step forward about 1.5s, and 5 and a half hours later it will take another step backwards (about 2.5 seconds). It takes about 14 hours before the clock is synchronized properly -- just in time to go to sleep again.

Work arounds?

Mar 22 08:09:55 stb-mac kernel[0]: System Sleep
Mar 22 08:09:55 stb-mac kernel[0]: System Wake
Mar 22 08:09:55 stb-mac kernel[0]: Wake event 0020
Mar 22 08:09:55 stb-mac configd[33]: posting notification com.apple.system.config.network_change
Mar 22 08:09:58 stb-mac kernel[0]: USB caused wake event (OHCI)

Console log shows that the sleep event is noticed after wakeup. Not good. It doesn't seem possible to "Note time of sleep, note time of wake up, adjust clock".

The "best" answer I have at the moment is to just restart ntpd after system wakeup. The clock will be 1.5s off for about 5 hours, but it will keep the right drift, and will only have to step once, and it won't step backwards.

Meanwhile, I do not know how to automatically do something on the wakeup. I don't know what scripts are run at wakeup.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Changing the kernel's tick

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.