1

As I understand, NTP drift file(/var/lib/ntp/ntp.drift in Debian-based distributions) stores the offset of the NTP peers and system clock. However, does the system clock mean CR232 battery on my motherboard? Something else? In addition, am I correct that this drift file is used only when ntpd is started?

2

Computers have timer hardware, that generates periodic interrupts known as tics. These usually occur 100 or more times per second. The timer may be part of the RTC, but even devices without a RTC have the timer hardware. Both the timer hardware and RTC have a tendency to drift from the real time as measured with an atomic clock.

NTP works with the system clock (software based), that is updated every tic. The value stored in /var/lib/ntp/ntp.drift is used to make a slight adjustments to the frequency of timer interrupts. This is referred to disciplining the clock. NTP will periodically recalculate the drift and update the frequency and the value in the ntp.drift file.

Typically, the system clock is set from the RTC when the system boots. This occurs before the NTP daemon is started. Depending on the flags set when the NTP daemon is started, it may fail if the RTC time has drifted significantly. To prevent this it was common to run the ntpdate command to perform an initial adjustment.

During a controlled shutdown, the RTC is usually set to the system time (either local or UTC). This helps ensure the time will be relatively accurate when the system is restarted. For this to work, the RTC must receive power when the system is down. Systems with an RTC have a battery which powers the RTC, and often some volatile memory that contains system configuration data.

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.