3

in my some of production environment time is drifted, i install ntp on my system.

when i am executing ntpstat command, i can see below output.

synchronised to NTP server (169.254.169.123) at stratum 4
   time correct to within 20 ms
   polling server every 512 s

but i am unable to understand this output.

Like if my linux time is 1 second drifted then i execute ntpstat command what the command will do.

is the command sync the time from ntp server and automatically adjust my local time.

how i be make sure that my linux time was incorrect and ntp correct this.

MadHatter
  • 79,770
  • 20
  • 184
  • 232

2 Answers2

6

Not to detract from Michael's excellent answer, but just to clarify things a bit: ntpstat doesn't set your clock. ntpstat talks to your ntpd and asks it how it's doing. ntpd, in turn, is constantly running in the background, doing its very best to keep your system time correct.

In your case, ntpd believes (and ntpstat therefore reports) that your system clock is right to within 20 milliseconds, which is enough for most people to get going on with, and about as good as you're likely to get with internet-based ntpd (ie, without your own local reference clocks).

You're at stratum 4 (ie, your time is coming from an upstream stratum 3 server), so provided your upstream clocks are right (ie, you're not playing silly buggers with odd local clocks and fudge disciplines, and I should add that the IP address you give for your upstream server makes me frankly nervous about that) then your local clock has already been drifted.

MadHatter
  • 79,770
  • 20
  • 184
  • 232
3

When ntpd makes an adjustment to the system clock, it will log a message in the system log. One of these two messages will appear:

time slew ? s
The time error exceeds the step threshold and is being slewed to the correct time. You may have to wait a very long time.
time reset ? s
The time error exceeds the step threshold and has been reset to the correct time. Computer scientists don't like this, but they can set the ntpd -x option and wait forever.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972