Time difference after waking up from suspend (local time vs UTC)

The BIOS of my XPS 13 9300 is in dual boot setup and uses the local time.
Every time the notebook wakes up from suspend, It seems to be set to UTC every time.
Hence I’m usually doing a manual NTP sync afterwards.

After waking up the time is set to Universal time.

timedatectl
               Local time: Fr 2024-05-17 01:20:27 CEST
           Universal time: Do 2024-05-16 23:20:27 UTC
                 RTC time: Do 2024-05-16 23:21:49
                Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: yes

And after NTP the time is set to Local time.

Any advice whether there’s something in Fedora to avoid this issue?

PS: there was a similar thread a while ago and the forum warned me not to necessarily revive it. I’m not sure what’s the etiquette on that.

You said dual boot. I assume windows?

This appears to be the way linux works.

Enter the bios setup menu and set the time on the RTC in bios to UTC. Then within each OS make certain the time zone is properly set the next time you boot.

Linux expects the RTC to be set to UTC by default and the time zone properly displays local time. If not set this way then NTP cannot keep the time in sync. In windows the time will also be displayed properly when you set the time zone after changing the time for the RTC in bios.

2 Likes

Hi,

I do not remember how I fixed it. I do know this article on the archwiki mentions something about time adjustment with dual booting.
It also says this

# UTC in Ubuntu/Fedora

Many Linux distributions have the hardware clock set to be interpreted as in "localtime" if Windows was detected on any disk during their installation. This is apparently done deliberately to allow new users to try out Linux on their Windows computers without editing the registry.

For changing this behavior, see above. 

I the problem persists, you can try replacing the service:

sudo systemctl --now disable chronyd.service
sudo systemctl --now enable systemd-timesyncd.service

The latter one works better in some cases.

1 Like

Older Windows versions assume the HW clock used local time, but the Arch Linux document mentioned by @youpie above provides a registry change to tell Windows to use UTC. For me, some Windows updates have reverted the registry change. Note that Arch Linux generally has excellent documentation and all linux distros share the same kernel.org code so many Arch documents are relevant to Fedora.

It turns out that this issue isn’t related to Windows at all.
The registry setting of Windows doesn’t influence it.

It doesn’t even matter whether I boot Windows or not.

Only booting into Fedora, letting the notebook sleep and waking it up switches the time to UTC again.

I don’t have such setting in BIOS. I can only change the date/time without a timezone settng (it’s similar to this screen)

Aparrently this fix:

sudo sed -i 's/LOCAL/UTC/' /etc/adjtime

helped many. I’ll try this.

But I’m not sure why this happens exactly. But generally this sounds like a bug to me.

Interesting. Does it have any potential disadvantages?
Will the date sync setting of the system influence this somehow?

gnome Date & Time setting for "Automatic Date & Time"

Correct.

The RTC setting in bios is independent of time zone and should be set to UTC.
The time zone setting in the OS then converts that to local time.

Yes.
I believe the automatic date and time function requires that the system have the location services enabled so it can verify the physical location of the machine. It may be disrupted if you are using a VPN that is not local to you since location services seems to rely on the last valid public IP in the path to your system…

That switch enables/disables one of the time sync services.
It relies on NTP which does not require location services.
You may be confusing it with automatic timezone.

1 Like

Added suspend-resume

Added dell, uefi

You take the current time, and subtract two hours, and that is the time to enter into the BIOS. For example if it is 14:21 at the moment you set the BIOS time to 12:21. This assumes you are in the Central European Summer Time. In the winter time you only subtract one hour.

1 Like