[ntp:questions] Re: adjtime()

Richard B. Gilbert rgilbert88 at comcast.net
Sat Apr 15 13:54:19 UTC 2006

SivaKumar Subramani wrote:

> I would like to know the usage of adjtime().
> When to use this adjtime() syscall in a program. If I want to adjust 3
> min
> time either +/- is it advisable to use this call.
> If I want to adjust 3 min using adjtime() how much time
> this shall take to adjust the system clock.
> Our problem is, we use POSIX timer to run a separate clock in our
> process, External process ahs the control of system clock.
> This process adjust the system clock using adjtime() to adjust 3 min
> time,
> we observed the clock which we running using POSIX timer lost 1 min
> over approx 10 min time. The timers doesn't get triggered or fired at
> the
> accuracy of 200 milli second during this adjtime() call. Due to this the
> process lost the accuracy of real clock.
> How to avoid this scenario???
> Any suggestions????
> Thanks in advance.
> Sivakumar
> _______________________________________________
> questions mailing list
> questions at lists.ntp.isc.org
> https://lists.ntp.isc.org/mailman/listinfo/questions

Your POSIX timer almost certainly derives its time from the system 
clock.  It will not be accurate while the system clock is being adjusted.

The maximum rate at which adjtime can adjust the clock is 500 parts per 
million or 500 microseconds per second.  It will take most of a day to 
make a three minute correction by slewing the clock.

If accurate time or accurate timing are important to you, you should not 
  use adjtime from a program you wrote.   Install and configure ntpd, 
start it, and let it synchronize your clock to UTC. It may take as long 
as a day.  With ntpd running and the clock synchronized, both absolute 
time and interval timing should be accurate to within milliseconds or 
even microseconds.

More information about the questions mailing list