how to check if NTP adjusted system time on Linux?

Solution 1:

You can use ntpdc -c sysinfo command for querying ntpd status. It returns an output similar to this:

system peer:          0.0.0.0
system peer mode:     unspec
leap indicator:       11
stratum:              16
precision:            -20
root distance:        0.00000 s
root dispersion:      338.44917 s
reference ID:         [73.78.73.84]
reference time:       00000000.00000000  Thu, Feb  7 2036  8:28:16.000
system flags:         auth monitor ntp kernel stats
jitter:               0.000000 s
stability:            0.000 ppm
broadcastdelay:       0.003998 s
authdelay:            0.000000 s

Solution 2:

The driftfile (/var/lib/ntp/drift) does not measure the difference between the local time and the time calculated by ntpd based on time servers contacted.

Instead it is the estimated drift (frequency error) of the local clock (in ppm). This value is updated by ntpd once an hour and does not decrease over time.

As far as I can tell the value is used by ntpd after a reboot to estimate how wrong the local clock is (the local clock runs even when the machine is powered off).

Example: Content of the file: 5 Machine was powered down 1 day (86400 s) 5 ppm of 86400 is 0.432 => The local clock is 0.432 s "in the future"

The points are: - ntpd can now apply a first approximate correction to the local time (-0.432 s) immediately after starting - ntpd knows immediately, how wrong the local clock is (in this example: 5 ppm)

(I am not allowed to comment on the comment of Sirex so I added a new comment)