English
Synchronizing the Date and Time
You can synchronize the hardware clock and the current system time in both directions.
Either you can set the hardware clock to the current system time by using this command:
[command]#hwclock --systohc#
Note that if you use NTP, the hardware clock is automatically synchronized to the system clock every 11 minutes, and this command is useful only at boot time to get a reasonable initial system time.
Or, you can set the system time from the hardware clock by using the following command:
[command]#hwclock --hctosys#
When you synchronize the hardware clock and the system time, you can also specify whether you want to keep the hardware clock in local time or UTC by adding the [option]`--utc` or [option]`--localtime` option. Similarly to using [option]`--set`, `UTC` or `LOCAL` is recorded in the `/etc/adjtime` file.
The [command]#hwclock --systohc --utc# command is functionally similar to [command]#timedatectl set-local-rtc false# and the [command]#hwclock --systohc --local# command is an alternative to [command]#timedatectl set-local-rtc true#.
Synchronizing the Hardware Clock with System Time
To set the hardware clock to the current system time and keep the hardware clock in local time, run the following command as `root`:
~]#{nbsp}hwclock --systohc --localtime
To avoid problems with time zone and DST switching, it is recommended to keep the hardware clock in UTC. The shown xref:Configuring_the_Date_and_Time.adoc#exam4-sect4-synchornizing-systohc-hwclock[Synchronizing the Hardware Clock with System Time] is useful, for example, in case of a multi boot with a Windows system, which assumes the hardware clock runs in local time by default, and all other systems need to accommodate to it by using local time as well. It may also be needed with a virtual machine; if the virtual hardware clock provided by the host is running in local time, the guest system needs to be configured to use local time, too.
Additional Resources
For more information on how to configure the date and time in {MAJOROSVER}, see the resources listed below.
Installed Documentation
`timedatectl`(1) — The manual page for the [command]#timedatectl# command line utility documents how to use this tool to query and change the system clock and its settings.
`date`(1) — The manual page for the [command]#date# command provides a complete list of supported command line options.
`hwclock`(8) — The manual page for the [command]#hwclock# command provides a complete list of supported command line options.
See Also