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.

I need to set ntpd to sync time as often as possible, how to do that?

UPD I need to make ntpd adjust system clock more frequently, not poll servers. It's necessary because system clock of my virtual PC drifts too much
maxpoll doesn't seem to change anything, because I set minpoll/maxpoll to 4 and 5, and time adjustments seem to be made only once in several minutes

share|improve this question
    
Why do you want to do this? –  Kyle Smith Apr 10 '12 at 14:52
    
Because I need precise time for my task. Any reasons not to do this? –  user626528 Apr 10 '12 at 14:56
6  
@user626528 define "precise time". Saying you need precision without quantifying the degree of precision you need is meaningless: Both a sniper rifle and a 51-inch mortar shell are "precise" munitions. –  voretaq7 Apr 10 '12 at 15:05

3 Answers 3

ntpd doesn't sync time periodically the way you think it does, see here for more information (read the whole thing, it's all important. Short version: ntpd syncs the time and tells the system how fast it's drifting away from "true" time, the system then adjusts its clock frequency to properly track "true" time. Within a day most systems are tracking to within 5ms of the reference).

Absent an EXCELLENT reason you should not be mucking about with the way ntpd adjusts and disciplines your clock - these algorithms have been thoroughly tested and debugged, and given an adequate time reference will produce very small error rates.
Frankly if you have such an EXCELLENT reason you already know what it is, and you have a substantial budget to hire an expert to make these modifications for you ("you wouldn't be asking this question if you really needed this").

If you require better time accuracy than what ntpd can get you on its own synchronizing against a machine over the network you need a specialized precision hardware reference clock attached locally to the machine. High-Frequency trading and picosecond-critical scientific experiments are about the only things I can think of that require this kind of precision.

share|improve this answer
    
My time server as monitored by NTP.org, with a rather lazy sync schedule: i.imgur.com/1leSH.png Still less than 50ms drift, and averages around 10ms. –  Chris S Apr 10 '12 at 15:14
    
@ChrisS that's a pretty wide band - you may have temperature control problems in your datacenter –  voretaq7 Apr 10 '12 at 15:21
2  
We use Precision Time Protocol when it's really critical... en.wikipedia.org/wiki/Precision_Time_Protocol –  ewwhite Apr 10 '12 at 15:26
1  
-1 algorithm or program that requires high precision and accuracy != mega corp with super massive budget. –  TheLQ Apr 16 '12 at 17:30
1  
One other use for having a local reference clock: high precision one-way network performance measurement. internet2.edu/performance/owamp –  Dan Pritts Feb 15 '13 at 22:17

Get a GPS time receiver if you need highly accurate time. It'll check your clock every second. If you don't want to spend much, you can get a Garmin 18x LVC on eBay or Amazon for <$100 and wire it to a COM port. Directions around the Internet, but does require a minimum level of wiring skill. Complete solutions are available that cost more, if you're not into DIY projects.

share|improve this answer

The iburst option does several checks quickly as soon as the daemon is started and whenever the server is unreachable if you have that in your configuration. The burst option does several checks quickly whenever the server is reachable.

By default ntpd then follows an exponential backoff where the time between checks progressively increases, starting at 64 seconds and doubling each time, up to a maximum of 1024 seconds.

The maxpoll option allows you to set the maximum value higher or lower. This value is the power of 2 in seconds between checks, so for 1024 seconds, maxpoll is 10. There is also minpoll which is 6 by default and can be lowered to 4.

If you want anything more frequent than every 16 seconds you will probably need to use ntpdate instead of ntpd and run your own loop.

Please don't aim this at public time servers without contacting the maintainers first.

share|improve this answer
2  
Probably best that he doesn't ever use NTPdate, as it doesn't obey KOD or ICMP messages. –  Chris S Apr 10 '12 at 14:59
    
Further reading on KoD and how to run a good NTP client in general: en.wikipedia.org/wiki/NTP_server_misuse_and_abuse –  Ladadadada Apr 10 '12 at 15:08
    
What @ChrisS said -- ntpdate is great for synchronizing the clock once, or for force-synchronizing against your own NTP server every second on machines where the local clock drift is atrocious. If you're in the latter situation, replace the machine (a clock that bad will be drifting by several seconds every minute -- you'll never have accurate time). –  voretaq7 Apr 10 '12 at 15:12
8  
Please, please, please DO NOT be that guy that changes the defaults on NTP. I have to look at my public-facing NTP server weekly and nuke the guys sending 1 packet every second. If your server doesn't listen to ICMP message saying "administratively prohibited," I will call your ISP's NOC and you will have a bad day. NTP will establish accurate to within milliseconds on its own and will adjust querying speed up and down as needed. Fiddling doesn't help. –  Jeff Ferland Apr 10 '12 at 16:16

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.