9

How to tell Ubuntu that hardware clock is local time?

This command didn't help:

timedatectl set-local-rtc 1
wjandrea
  • 14,109
  • 4
  • 48
  • 98
Dims
  • 1,763
  • 10
  • 33
  • 50
  • 1
    This is the correct command, but it doesn't work immidiately. Run it as `timedatectl set-local-rtc 1 --adjust-system-clock`. – Pilot6 Aug 15 '17 at 17:48
  • If you're dual-booting with Windows, consider setting Windows to UTC RTC instead using the [RealTimeIsUniversal registry setting](https://gist.githubusercontent.com/cubuspl42/ab9fa93f38cd6245884cb8adedfe76ca/raw/656c4f854eb44b13e29711ff95f885c4a1180a43/RealTimeIsUniversal.reg). – rustyx Aug 31 '22 at 14:33

1 Answers1

17

In Ubuntu releases that use systemd the command to change time to local and update the clock right away is

timedatectl set-local-rtc 1 --adjust-system-clock

If you run timedatectl, it will show with a warning

               Local time: ...
           Universal time: ... 
                 RTC time: ...     
                Time zone: ...
System clock synchronized: yes                         
              NTP service: active                      
          RTC in local TZ: yes  

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

This warning doesn't mean that it is set to 0. If it was set to 0, timedatectl status says:

RTC in local TZ: no

and there is no Warning.

RTC in local TZ: yes

is preferred, if you're dual booting. The suggested command is for switching RTC back to "no".

Error404
  • 6,920
  • 1
  • 26
  • 50
Pilot6
  • 88,764
  • 91
  • 205
  • 313
  • I tried that, but seems not working, when I tried 'timedatectl | grep local', it said ** RTC in local TZ: yes Warning: The system is configured to read the RTC time in the local time zone. 'timedatectl set-local-rtc 0'.** – Michael Aug 24 '17 at 12:24
  • So it seems Ubuntu is already using local time, but after using your instruction on a terminal, it still showed timedatectl set-local-rtc 0, what I'm doing wrong? – Michael Aug 24 '17 at 12:32
  • You are not doing anything wrong. There is a warning that in some cases it is better to use RTC and suggests how to change it. Why don't you red the whole warning? It is quite clear. – Pilot6 Aug 24 '17 at 13:03
  • The warning said: "Warning: The system is configured to read the RTC time in the local time zone. 'timedatectl set-local-rtc 0'.", so I'm assuming it's already using local time, but why it showed 0? I've tried to change RTC file, and there's no entry with UTC=, can I just add it? – Michael Aug 24 '17 at 13:29
  • It is not "showing 0", it suggests to run `'timedatectl set-local-rtc 0` to switch it back to RTC. It says "use RTC in UTC by calling 'timedatectl set-local-rtc 0'" It doesn't say that it is set to 0. – Pilot6 Aug 24 '17 at 14:05
  • If it is still not clear, you can ask a new question. – Pilot6 Aug 24 '17 at 14:10
  • Thanks Pilot6, you're correct, after issuing the command, windows is giving me the right time now, thanks for your feedback and being patient with my questions. – Michael Aug 26 '17 at 11:11
  • This whole issue arises (usually) for people who either dual boot (after a Windows installation), or are using a computer that used to have windows and now they have installed (Linux) Ubuntu. The issue is that all UNIX based systems use UTC (GMT) as the time setting in the BIOS; but if the BIOS time setting (usually listed as "LOCAL TIME AND DATE") is set as local time & date you will have a problem with *NIX systems. UNIX systems use the BIOS time (UTC and/or RTC (CMOS)) as a reference point and then the O/S adjusts the time depending on your TZ. – Andor Kiss Nov 04 '20 at 11:50