1

How will NTP discipline my Clock?

In order to keep the right time, xntpd must make adjustments to the system clock. Different operating systems provide different means, but the most popular ones are listed below.

  • Basically there are four mechanisms (system calls) an NTP implementation can use to discipline the system clock:

settimeofday(2) to step (set) the time. This method is used if the time if off by more than 128ms.

  • adjtime(2) to slew (gradually change) the time. Slewing the time means to change the virtual frequency of the software clock to make the clock go faster or slower until the requested correction is achieved. Slewing the clock for a larger amount of time may require some time, too. For example standard Linux adjusts the time with a rate of 0.5ms per second.
  • ntp_adjtime(2) to control several parameters of the software clock (also known as kernel discipline). Among these parameters are:
  • Adjust the offset of the software clock, possibly correcting the virtual frequency as well
  • Adjust the virtual frequency of the software clock directly
  • Enable or disable PPS event processing
  • Control processing of leap seconds
  • Read and set some related characteristic values of the clock
  • hardpps() is a function that is only called from an interrupt service routine inside the operating system. If enabled, hardpps() will update the frequency and offset correction of the kernel clock in response to an external signal