[ntp:questions] how do I lock in average frequency correction

David Lord snews at lordynet.org
Sun Feb 12 05:42:09 UTC 2012

Ron Frazier (NTP) wrote:
> Hi all,
> I've been reading around in the faq's at ntp.org and various pages 
> googling around and cannot find obvious answers to these questions.
> It is my understanding that NTP is continuously making small changes to 
> the software clock to keep the timing accurate while the os is running.  
> 95% of the time, my computers are doing the same thing and 95% of the 
> time, I'm doing the same thing with the computers.  Therefore, over a 
> long time interval, the interrupt usage should be similar, and over a 
> long time interval, the correct clock frequency to maintain accuracy 
> should be similar.
> So, what I want to do is figure out what the average frequency to keep 
> accurate time is over say a week or month.  I then want to fix the 
> frequency at that level and leave it there.  Then, under normal 
> conditions, the clock should drift very little on average.  If certain 
> usage conditions, say transcoding a movie, make the clock drift more 
> rapidly, I want it to step the time or slew it for that occasion, but 
> not to alter the long term correction factor at all.  That way, when my 
> usage patterns return to normal, the drift should again return to a very 
> slow rate.

Ntpd already should do that if you leave it alone without
making changes. On my NetBSD system there is a file
"/var/db/ntp/ntpd.drift" which is used by ntpd to keep
track of the current frequency offset. Other systems and
distributions will use different locations for the file.

> I also would like to understand how ntp interacts with the Real Time 
> Clock.  I think I've read that either NTP or the OS (I don't know which) 
> will save the time to the RTC when shutting down and retrieve the time 
> from the RTC when booting up.  I'd like to know if this is true, first 
> of all, and I'd like to know if it makes any corrections to the clock 
> rate of the RTC so it is more accurate.

Ntpd does not interact with my systems RTCs. There are
probably some utilities that can set the RTC to current
time or set the time from the RTC but I don't know of
any for my systems. Chrony on Linux is able to use the
RTC and compensate for periods when the system is not


> Any help is appreciated.
> Sincerely,
> Ron

More information about the questions mailing list