16.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:
  1. Add the following line to the /etc/sysconfig/ntpdate file:
    SYNC_HWCLOCK=yes
  2. Enable the ntpdate service as root:
    ~]# systemctl enable ntpdate.service
Note that the ntpdate service uses the NTP servers defined in the /etc/ntp/step-tickers file.

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
To make the hardware clock update every time the system clock is updated by the ntpd or chronyd service, start the ntpdate service as root:
~]# systemctl start ntpdate.service
To make the behavior persistent across boots, make the service start automatically at the boot time:
~]# systemctl enable ntpdate.service
As a result of enabling the ntpdate service, every time the system clock is synchronized by ntpd or chronyd, 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.