Which system calls made by NTP affect the CLOCK_MONOTONIC?
Asked Answered
C

0

6

I have been looking for an answer to this one but no clear documentation yet.

The CLOCK_MONOTONIC from clock_gettime man page says that it's affected by incremental adjustments performed by adjtime and NTP

CLOCK_MONOTONIC

Clock  that  cannot  be set and represents monotonic time since some unspecified
starting point. This clock is not affected by discontinuous jumps in the system
time (e.g.,  if  the  system  administrator manually  changes  the  clock),
but is affected by the incremental adjustments performed by adjtime(3) and NTP

What is not clear to me is that is it affected by all sorts of adjustments made by NTP or just the small adjustements ?

Say if there is a big time jump made by NTP, if the system was way off the clock, will CLOCK_MONOTONIC reflect that ?

I am not sure which of the following system calls NTP makes to adjust the time on my Cent OS system

A quick test showed no change in monotonic clock output even though NTP made the system jump by 10 hours.

Even making the time jump by clock_settime call didn't affect MONOTONIC time

Croton answered 11/2, 2019 at 16:48 Comment(1)
adjtime() gradually adjusts the system clock, as does NTP under "normal" conditions. However, NTP will sometimes "step"/"jump" the clock (if it detects a peer offsset too great for too long a period). So, it sounds like CLOCK_MONOTONIC filters out "steps"/"jumps", which would tend to make it at least more monotonic than otherwise in the event of "steps"/"jumps".Braided

© 2022 - 2024 — McMap. All rights reserved.