18.18. Configuring the Hardware Clock Update
- Instant one-time update
- To perform an instant one-time update of the hardware clock, run this command as root:
- Update on every boot
- To make the hardware clock update on every boot after executing the ntpdate synchronization utility, do the following:
Note that the
- Add the following line to the
- Enable the
ntpdateservice as root:
systemctl enable ntpdate.service
ntpdateservice uses the NTP servers defined in the
NoteOn virtual machines, the hardware clock will be updated on the next boot of the host machine, not of the virtual machine.
- Update via NTP
- You can make the hardware clock update every time the system clock is updated by the
ntpdservice as root:
systemctl start ntpd.serviceTo make the behavior persistent across boots, make the service start automatically at the boot time:
systemctl enable ntpd.serviceorStart the
chronydservice as root:
systemctl start chronyd.serviceTo make the behavior persistent across boots, make the service start automatically at the boot time:
systemctl enable chronyd.serviceAs a result, every time the system clock is synchronized by
chronyd, the kernel automatically updates the hardware clock in 11 minutes.
WarningThis approach might not always work because the above mentioned 11-minute mode is not always enabled. As a consequence, the hardware clock does not necessarily get updated on the system clock update.To check the synchronization of the software clock with the hardware clock, use the
ntpdc -c kerninfoor the
ntpdc -c kerninfoThe result may look like this:
pll offset: 0 s pll frequency: 0.000 ppm maximum error: 8.0185 s estimated error: 0 s
status: 2001 pll nanopll time constant: 6 precision: 1e-09 s frequency tolerance: 500 ppmor
ntptimeThe result may look like this:
ntp_gettime() returns code 0 (OK) time dcba5798.c3dfe2e0 Mon, May 8 2017 11:34:00.765, (.765135199), maximum error 8010000 us, estimated error 0 us, TAI offset 0 ntp_adjtime() returns code 0 (OK) modes 0x0 (), offset 0.000 us, frequency 0.000 ppm, interval 1 s, maximum error 8010000 us, estimated error 0 us,
status 0x2001 (PLL,NANO), time constant 6, precision 0.001 us, tolerance 500 ppm,To recognize whether the software clock is synchronized with the hardware clock, see the status line in the output (highlighted).If the third digit from the end is 4, the software clock is not synchronized with the hardware clock.
status 0x2401If the second digit of the last four digits is not 4, the software clock is synchronized with the hardware clock.