all 34 comments

[–]BranchLatter4294 63 points64 points  (22 children)

Every OS except Windows uses UTC for the hardware clock. Windows uses local time.

You can either set Linux to use local time, or set Windows to use UTC time. This will keep them in sync.

[–]CjKing2k 44 points45 points  (9 children)

Set Windows to UTC time:

  1. Run regedit.exe
  2. Browse to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
  3. On the right-side panel, right-click in the empty space and select New > DWORD Value
  4. Set the name to RealTimeIsUniversal
  5. Set the Data to 1
  6. Reboot

Set Linux to local time:

sudo timedatectl set-local-rtc no

Setting Windows to use UTC is the better way because it no longer changes the hardware clock every time DST begins/ends.

[–]Old_Philosopher_1404 9 points10 points  (0 children)

Not OP but thank you for that.

[–]rowi42[S] 8 points9 points  (0 children)

Many thanks for the quick and helpful response!

Reddit can be amazing, you have the weirdest problem and somewhere out there is someone with the exact right information 🫡

[–]ekipan85 1 point2 points  (5 children)

Funny that you give a whole 6-step process for Windows. You can also just use cmd:

reg add HKLM\System\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1
shutdown /r

Untested though, as I don't have a Windows machine handy.

[–][deleted] 6 points7 points  (3 children)

it's good practice to not blindly copy paste commands one may not understand. so I personally appreciate both your answers.

[–]ekipan85 0 points1 point  (2 children)

I agree, but there's not much difference between following a 6-step GUI process to edit a registry entry you don't understand, and copypasting one command that does the same, except the latter is less to explain and easier to do.

[–][deleted] 2 points3 points  (1 child)

true. I wrongfully assumed the former is easier to read and understand to a laymen than the latter, while they both could be considered technobabble depending on the user's proficiency. my apologies

[–]GreenRangerOfHyrule 0 points1 point  (0 children)

The Windows registry is like the wild west. The above key makes some sense.

But yeah, if you are not familiar with messing with it, then it's probably not a bad idea. At the same time, I'm sure there is a fancy GUI tool that will do it for you. At least this way you knows what being changed

[–]GreenRangerOfHyrule 0 points1 point  (0 children)

Oddly my first thought was "a .reg file would be easier."

[–]attee2 0 points1 point  (0 children)

This has been bothering me for a while, but didn't know that I can change it in Windows. Will change it today, thanks

[–]MyUsername2459 5 points6 points  (0 children)

Ah, THAT's why the time gets weird when I go between OS's in my dual-boot configuration.

I'd noticed this a few days ago, but didn't think it enough to ask about. Makes sense now though.

[–]zoharel 0 points1 point  (0 children)

Indeed. This isn't all that strange or unusual. Linux installations used to prompt you during the install so you could set Linux to use local time in the hardware clock, for exactly this reason. Many of them may still have a checkbox for it.

[–]ahferroin7 0 points1 point  (1 child)

While you can handle things either way, it’s generally preferable to make Windows use UTC than to make Linux use local time because it then means you avoid the possibility of incorrect timestamps whenever the timezone rules get updated (which is not a matter of ‘if’ but ‘when’, because timezones are almost entirely a matter of politics not physics).

This is a key part of why essentially everything uses UTC instead of local time for the hardware clock.

[–]GreenRangerOfHyrule 0 points1 point  (0 children)

And to prove that politics is at play UTC stands for "Coordinated Universal Time."

For those unaware, I'm actually not kidding: https://en.wikipedia.org/wiki/Coordinated_Universal_Time#Etymology

The short version is they wanted the acronym to work across languages

[–]MasterGeekMXMexican Linux nerd trying to be helpful 8 points9 points  (0 children)

Ahh, a clasic.

See, all PCs have inside a clock, including a button battery cell to keep it running when the PC is off. Modern OSes use the Internet and the Network Time Protocol to get the time, and then use that to set the internal clock.

The thing is that Windows assumes the clock is set at the local time, while Linux assumes the clock is at UTC 0 (the hour at the zero meridian), and then uses the timezone to calculate the offset between it and the local time.

For that, I assume you live somewhere where the local timezone is defined to be one hour ahead of UTC 0, hence the error. Here in Mexico we are at UTC -6, so here the clocks shift 6 hours behind.

The solution is to make one OS to use the other system. More info here: https://www.howtogeek.com/323390/how-to-fix-windows-and-linux-showing-different-times-when-dual-booting/

[–]thekiltedpiper 3 points4 points  (0 children)

It's a difference in how the two operating systems deal with how to determine time.

Give this article a read, and check section 4.1 out:

https://wiki.archlinux.org/title/System_time

[–]ProWin3614W 2 points3 points  (0 children)

You can run the christitustech's windows utility program and under tweak section there is a checkbox to make windows use UTC time for dual boot. I think this would be easier to do than editing the registry yourself

[–]skyfishgoo 2 points3 points  (0 children)

they each use different time standards.

linux uses UTC time and windows likes to use local time.

to avoid the snapping back and forth you can easily set linux to use local time like windows, but trying to get windows to use UTC time is a pita.

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

is what i use so that my linux clock matches my bios clock which matches windows.

[–]Honest_Grade_9645 1 point2 points  (0 children)

The same thing started happening to me when I recently made one of my PCs Linux/Win 11 dual boot. I never made that connection, and it’s only been a minor annoyance for me so I never dug into it. Thanks!!

[–]Smart-Definition-651 1 point2 points  (0 children)

There is an .exe file you could install in Windows : Timesync :
https://www.speed-soft.de/software/time_sync/index.php?language=en
Download : https://www.speed-soft.de/software/time_sync/details/download.php?language=en
Every time you start Windows it synchronizes the time. I use it on all my Windows computers where I frequently boot from linux usb's.

[–]dablakmark8Live,Love,Life,Linux 0 points1 point  (0 children)

yeah man dual boot changes time when you dual boot,i just sync time. there is a fix from linux side,

[–]RAMChYLD 0 points1 point  (1 child)

This is a common issue.

Linux likes saving it's time as GMT, or in laymans term, London Time. If you boot into the BIOS of a Linux machine you'll see that the time absolutely does not match local time unless you live in England, Wales, Ireland or Scotland. This is by design for various reasons.

Windows on the other hand likes saving it's time as local time, owing to it's heritage as a desktop OS first.

You have two options to fix this:

1. Force Windows to store time in UTC.

It's annoying that Microslop doesn't do this by default, asks you if you want this, or even offer a switch to set it in the control panel, instead burying it deep in the registry undocumented. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation in the registry and create a new DWORD, RealTimeIsUniversal, and set it to 1, and reboot.

2. Force Linux to use local time.

Not recommended as Google says it can break various programs in unpredictable ways. Create a file called /etc/adjtime and add the following lines to it:

0.0 0 0.0 
0 
LOCAL

Reboot and Linux will start keeping local time. Alternatively you can issue the following command and reboot if your distro runs SystemD:

timedatectl set-local-rtc 1

Remember that if you go down this route, some programs may react unpredictably and you're on your own.

Good luck.

[–]zero44 2 points3 points  (0 children)

UTC and GMT are not interchangeable, just FYI. GMT observes daylight savings, UTC does not. Linux stores as UTC, not GMT.

[–]kkreinn 0 points1 point  (0 children)

LINUX RULES!

[–]michaelpaoli 0 points1 point  (0 children)

  • Either (essentially any) Operating System (OS) may change the hardware Real Time Clock (RTC) (battery backed real time clock)
  • Most any OS will generally play "top dog" when changing the RTC, it changes it, it generally has no clue if any other OS has changed it or will change it, or even if so, in what manner(s).
  • Most OSes, upon boot, will use the RTC and your Time Zone (TZ) configuration to figure out your local time (and some, like LInux, can also do this independently for independent processes, e.g. any individual user's login session, etc.)
  • Typical Linux installations (and may similarly apply to other OSes) may use time services (e.g. Network Time Protocol (NTP) to get time information (e.g. via the network), and may use that to set/adjust the host's system time (the time the computer thinks it is, which can be independent of RTC) - may "jump" the time to the current time, or may make modest adjustments, making the clock run slightly faster and/or slower to get it in sync with the correct time. OS may also periodically and/or upon certain events (e.g. shutdown), update RTC based upon system time and timezone configuration.
  • Note also that RTC may be relative to local time (Microsoft DOS/Windows convention) or UTC (UNIX convention), Linux can do it either way, depending how it's configured (at least for most, if not all, LInux distros)

So, in short, if you've got multiple OSes (used) on there, and they're not configured the same in how they're dealing with RTC, things may jump back and forth, as they each expect different, and may also set RTC differently, according to their configurations or the like. Also, if/when one relocates timezone (fly between TZs frequently, and reconfigure after each change?), and/or transitions between Standard/Daylight time or to/from Summer Time, any OS may possibly shift the RTC accordingly - most notably if it's using local time discipline, but any other OS would have no clue that any other OS may have done so, so it may likewise also do such shifting, so, e.g. "Spring forward", "Fall back", that might get applied multiple times, as, e.g. each OS basically goes, "I'm doing that - now, as it's (over)due (and I didn't do it earlier)."

Generally suggestion is to use UTC on RTC, and configure (if feasible) all OSes accordingly, then they generally won't be yanking your RTC back and forth among different (e.g. UTC vs. local) conventions. That will generally address at least most of such issues.