Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

In many primers on ntpd, like this one, there's always a warning that ntpd will stop resetting the clock "[if] your clock is too far off."

How far off is "too far off"?

Also, if a server takes a sudden jump to heavy load, for example from total idleness to 100% CPU, will the increase in temperature cause the clock to skew to "too far off"?

Can ntpd be configured to reset the clock even if the time is "too far off" or at least make "too far off" a little farther?

share|improve this question
    
How far off is "too far off"? Depends. What OS(es)/distros are you you using, specifically? –  HopelessN00b Jun 26 at 14:24
    
@HopelessN00b ubuntu server. I figured it'd be hard to pin down because of the algo's complexity, so I can live with a ballpark figure. –  user144330 Jun 26 at 14:25
    
All of your questions are variables that you can set in the configuration –  Jacob Jun 26 at 14:29
    
@Jacob Thank you Jacob! Would you mind showing me where? I've never seen anything that widens the reset band, and all I can find for higher sync frequency is burst which gets you banned. :/ Thank you so much in advance! –  user144330 Jun 26 at 14:30
    
I don't think CPU load or temperature should have any effect on your clock. All the timers on a typical computer ultimately come from an oscillator which, as far as I know, is outside the CPU package and not affected by anything the CPU is doing. –  Nate Eldredge Jun 26 at 15:29

4 Answers 4

up vote 13 down vote accepted

First off, the default max difference is 1000s as others have mentioned. As @kyle stated you can use the -g flag to ignore this ONE time only to initially set your clock.

After that you really shouldn't see your clock drifting by 1000s between updates even under highload, and if you do you really need to replace the clock. The settings in the configuration you need are minpoll and maxpoll. These will allow you to set the interval duration to the power of 2 (e.g. 10 means 210 = 1024 s).

Please note that your system is likely not going to drift substantially even under high load, and the default settings should keep it in check. You don't want to bombard NTP servers with updates every second as you are wasting resources it will get you blocked and most likely a call to your ISP NOC. If you really need extremely accurate time use GPS or setup your own NTP server.

share|improve this answer
1  
Depending on what you do, the few ms it can drift per day are "substantially" for people. –  PlasmaHH Jun 26 at 15:30
1  
@PlasmaHH Then I would suggest utilizing a better time source such as GPS. –  Jacob Jun 26 at 15:42
    
Thank you so much Jacob! Do you happen to know what the most common rate limit is? I'd like to maintain good time within the 10ms band shown here ntp.org/ntpfaq/NTP-s-algo.htm#Q-ACCURATE-CLOCK without expensive hardware. Thank you very much in advance! –  user144330 Jun 26 at 16:26
    
@Gracchus It's up to the individual NTP servers, and you'd have to contact them. In my opinion you're trying to use NTP as a crutch for something where you need highly precise time. As such you should use a better solution (like GPS) to obtain it rather than add load to a free service. –  Jacob Jun 26 at 16:32
1  
@Gabe: Replace here can also mean to add another clock to the system. Also there are quite some options to add various kinds of clocks as pci cards. –  PlasmaHH Jun 27 at 8:42

NTPD can adjust your clock in slow increments if it's off, clock slewing. The idea behind that is that slow steps won't cause issues with software timers, strange gaps in log files etc.

The maximum slew rate possible is limited to 500 parts-per-million (PPM) by the Unix kernel. As a result, the clock can take 2000s for each second the clock is outside the acceptable range.

According to the manual page ntpd won't work if your clock is more then 1000 seconds off.

Since slewing the clock to adjust it by 1000 seconds will take at least 3 weeks and during that time all date/timestamps are still off, that doesn't seem unreasonable.

The ntpdate command has a -b switch to simply adjust the time without slewing. This is useful in cases where the the local system clock deviates too much from the "correct" time.

share|improve this answer

This is specified in man ntpd, and you override it you might be interested in the -g option (Note the "which is 1000 s by default":

-g Normally, ntpd exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, ntpd will exit with a message to the system log. This option can be used with the -q and -x options. See the tinker command for other options.

You can adjust this in ntpd.conf. If you want to disable it you can set tinker panic 0. See the Miscellaneous Options documentation to learn more.

share|improve this answer
    
Perfect! Finally found minpoll and maxpoll. Thank you! –  user144330 Jun 26 at 14:40
    
Kyle this is wrong. This is a one off command, and will not address future issues. Nor do you mention minpoll or maxpoll. –  Jacob Jun 26 at 14:41

Why not have it sync every 4 hours via crontab ? That way you can be certain that you would have a reasonable time synchronization . I think it's about 1000 seconds depending on ntpd version .

share|improve this answer
    
I'd read that ntpd syncs every minute or so. Is that not true? –  user144330 Jun 26 at 14:24
    
You can use ntpq -p to see how it is configured because it's variable –  Alex H Jun 26 at 14:27
    
Thank you Alex H! That's not good. Both ntpd and ntpdate seem to only shift by 5ms per sample towards offset 0, and my poll for stratum 1 server is at 256. :( I know that when my server suddenly goes to 100% CPU and remains, which happens frequently because of my application, the clock skews badly by 10s of ms. Not good. –  user144330 Jun 26 at 14:37
1  
You could try to limit the application priority with renice / nice or from the start up parameters somewhere where the ntpd is not affected by it , if it's affecting ntpd it might affect other applications also and it's affecting system stability –  Alex H Jun 26 at 14:41
1  
Ah, so this app may simply be blocking everything else? Definitely possible with the way it's written. Thank you for the new tool! –  user144330 Jun 26 at 14:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.