7

I have a server that I am now managing that has clock drift and would like to correct the difference without causing a jump back in time on the server.

I have read about the technique of leap second smearing and wondered if there was a similar way to smear ntp corrections (particularly if the correction will turn the system clock back)?

2 Answers 2

5

NTP should automatically take care of this, without brutal clock jumps or anything.

You can run ntpd -q to synchronize the time once and quit.

Note that if the clock skew is too big (>1000 secs), NTP will panic and quit. Run the NTP daemon with ntpd -g to force it to adjust the clock even in that case.

Avoid using ntpdate which is deprecated.

2
  • 1
    Do you have a reference for this dr01? I've been sifting through the ntp documentation but haven't found anything yet.
    – sysadmiral
    Oct 26, 2017 at 10:03
  • I took it from my notes. That should be described in man ntpd, I believe.
    – dr_
    Oct 26, 2017 at 10:12
5

With thanks to the pointers from dr01 I found the answer in a mailing list response here. The key difference was the terms I was using. ntp uses "step" over "jump" and "slew" over "smear".

Stepping: Time changes in large units, quickly With "Step" method (settimeofday), time is gradually changed with higher rate or time is changes immediately to correct time.

step == reset the clock to the correct time in one instantaneous step. A stepped clock can "move backwards".

slew == adjust the clock by speeding it up or slowing it down. A slewed clock never "moves backwards"

In summary ntp will slew the time if the difference is below a threshold (128ms) and step the time if the difference is above that threshold.

In the ntpd documentation it details the -x option which allows you to force ntp to always slew corrections even if the difference is above the default threshold:

-x Normally, the time is slewed if the offset is less than the step threshold, which is 128 ms by default, and stepped if above the threshold. This option forces the time to be slewed in all cases. If the step threshold is set to zero, all offsets are stepped, regardless of value and regardless of the -x option. In general, this is not a good idea, as it bypasses the clock state machine which is designed to cope with large time and frequency errors Note: Since the slew rate is limited to 0.5 ms/s, each second of adjustment requires an amortization interval of 2000 s. Thus, an adjustment of many seconds can take hours or days to amortize. This option can be used with the -q option.

But with a maximum slew rate of 500ppm (parts-per-million) this means correcting a difference of 5 minutes would take about 7 days.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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