1

The times on my arch linux workstation got messed up, so I set the system time with date and then the hardware time with

sudo hwclock --systohc --utc

Now the hwclock gives:

Do 04 Apr 2013 14:12:48 CEST  -0.641471 seconds

but I want it to use UTC, which would be 12:12:48! How do I achieve this?

edit:

some additional weirdness:

$ hwclock --utc
Do 04 Apr 2013 14:20:56 CEST  -0.188214 seconds
$ hwclock --localtime
Do 04 Apr 2013 12:21:01 CEST  -0.438205 seconds
$ date -u
Do 4. Apr 12:21:11 UTC 2013
$ date
Do 4. Apr 14:21:16 CEST 2013

utc and localtime seems to be confused by hwclock...

steffen
  • 157
  • 1
  • 2
  • 8
  • `hwclock` shows the local time, even if the hardware clock is on UTC. To find out what's really going on, use `timedatectl` — "RTC time" is your hardware clock. Use `ntpd -qg` and `hwclock -w` to get the hardware clock set right. – Zaz Jun 03 '15 at 20:24

3 Answers3

7

Yep, in Linux you can use hwclock --systohc, and pay your attention to its manual saying that «…

The time shown is always in local time, even if you keep your Hardware Clock in Coordinated Universal Time. See the --utc option. Showing the Hardware Clock time is the default when no function is specified.

…»

And, BTW, my man hwclock also reveals option --debug which would really help you in your search of the truth.

poige
  • 9,171
  • 2
  • 24
  • 50
  • ahrghhh! so `hwclock --localtime` shows the local time assuming that the hardware clock is using localtime, which results in something that appears wrong at firts sight!!! Fair enough... – steffen Apr 04 '13 at 12:39
  • @steffen, see update regarding `--debug` also… – poige Apr 04 '13 at 12:41
  • yep, that makes it clear... it is confusing, though. With `date` the option changes what is to be desplayed, while with `hwclock` the option changes the assumption in order to calculate the displayed time. – steffen Apr 04 '13 at 12:44
0

hwclock and timedatectl shous different info about cmos (hardware_clock)

ubuntu 20.04 dell laptop

My hardware clock show up less time than utc and the observation is with

Recife-PE - London-GB (greenwich)

Thanks

No idea what is occurring, but with timedatectl setup to localrtc 1 appears to gos to normal back

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://serverfault.com/help/whats-reputation) you will be able to [comment on any post](https://serverfault.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/519558) – Dave M May 04 '22 at 11:41
0

Try this:

hwclock --set --date "2022-05-03 00:23:00" && sudo hwclock --localtime

after above command as root, run timedatectl:

timedatectl (warning disappears relative to rtc) 

no reboot necessary.

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79