Ubuntu – How to check if hardware clock is in UTC or Local time


From what I've read the hwclock -r command only returns the time in local time no matter how it is set. I think hwclock --utc or hwclock --localtime will change the clock to UTC or localtime. But I don't want to change it; I want to know how it is currently set.

So how can I check if my hardware clock is set to UTC time or local time?

Best Answer

Ubuntu 15.04 and later uses systemd as the default init system and includes the timedatectl program. Running timedatectl will output:

      Local time: Tue 2016-02-02 09:47:54 MST
  Universal time: Tue 2016-02-02 16:47:54 UTC
        RTC time: Tue 2016-02-02 16:47:54
       Time zone: America/Denver (MST, -0700)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

RTC time is the hardware clock. Compare it to the Local time and Universal times returned by timedatectl to determine how the hardware clock is set.

RTC in local TZ: no means the hardware clock is interpreted as UTC

RTC in local TZ: yes means the hardware clock is interpreted as local time

To switch using timedatectl

sudo timedatectl set-local-rtc 0 sets RTC to UTC

sudo timedatectl set-local-rtc 1 sets RTC to local time

Switch using config file

Setting the UTC= setting in /etc/default/rcS will change how the system interprets the hardware clock (UTC=yes or UTC=no).