This section discusses how to configure the systemd-timedated system service, which configures system clock and timezone.
Systemd provides a timedatectl utility which is used to communicate with systemd-timedated. It can be used to set the system clock in local time or UTC time, depending on the hardware clock setting. By default, systemd-timedated will assume that clock is set to UTC time.
If you cannot remember whether or not the hardware clock is set to
UTC, find out by running the hwclock
--localtime --show
command. This will display what
the current time is according to the hardware clock. If this time
matches whatever your watch says, then the hardware clock is set to
local time. If the output from hwclock is not local time, chances
are it is set to UTC time. Verify this by adding or subtracting the
proper amount of hours for the timezone to the time shown by
hwclock. For example,
if you are currently in the MST timezone, which is also known as GMT
-0700, add seven hours to the local time.
systemd-timedated reads
/etc/adjtime
, and depending on the
contents of the file, it sets the clock to either UTC or local time.
Create the /etc/adjtime
file with the
following contents if your hardware clock is set to local time:
cat > /etc/adjtime << "EOF"
0.0 0 0.0
0
LOCAL
EOF
If /etc/adjtime
isn't present at first
boot, systemd-timedated
will assume that hardware clock is set to UTC and adjust the file
according to that.
If your clock is set to local time, tell systemd-timedated about it by running the following command:
timedatectl set-local-rtc 1
timedatectl can also be used to change system time and time zone.
To change your current system time, issue:
timedatectl set-time YYYY:MM:DD HH:MM:SS
Hardware clock will also be updated accordingly.
To change your current time zone, issue:
timedatectl set-timezone TIMEZONE
You can get list of available time zones by running:
timedatectl list-timezones
Please note that timedatectl command can be used only on a system booted with systemd.