Show Table of Contents
18.18. Configuring the Hardware Clock Update
The system clock can be used to update the hardware clock, also known as the real-time clock (RTC). This section shows three approaches to the task:
- Instant one-time update
- To perform an instant one-time update of the hardware clock, run this command as root:
~]#
hwclock --systohc - Update on every boot
- To make the hardware clock update on every boot after executing the ntpdate synchronization utility, do the following:
- Add the following line to the
/etc/sysconfig/ntpdatefile:SYNC_HWCLOCK=yes
- Enable the
ntpdateservice as root:~]#
systemctl enable ntpdate.service
Note that thentpdateservice uses the NTP servers defined in the/etc/ntp/step-tickersfile.Note
On 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
ntpdorchronydservice:Start thentpdservice 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 thechronydservice 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 byntpdorchronyd, the kernel automatically updates the hardware clock in 11 minutes.Warning
This 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 thentpdc -c kerninfoor thentptimecommand asroot:~]#
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 0x2401
If the second digit of the last four digits is not 4, the software clock is synchronized with the hardware clock.status 0x2001

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.