Windows vs Linux Local Time?
Solution 1:
Neither is wrong, but using UTC is more right. The RTC doesn't have a time zone; it's just a dumb wall clock. If your local time zone honors DST (of which there are many flavors, and rules change arbitrarily), then twice a year, you have to go and change it. The OS will do it for you, but if the RTC is UTC, the OS does the UTC->local translation anyway -- why fiddle with the clock? Furthermore, during the DST "fall back" transition, the RTC can't tell you what time it is! Is it 1:30am CDT or CST?
Apparently, Windows 8 supports UTC for the RTC. Windows 7 also did, but there were issues.
There was a better argument against this back when people set their BIOS clocks manually, but server-based time is much more prevalent now.
Solution 2:
I recently faced the same problem and this is how I fixed it. You need to do a little change in both OS.
I started with Linux first. Run these following commands as root.
ntpdate pool.ntp.org
This will update your time if not set correctly.
Now set the hardware clock to UTC with this command.
hwclock --systohc --utc
Source
Now boot to Windows and add the following registry. Just simply create a .reg file using the code below in Notepad. Save it and run it.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
Source
From next boot onward both OS will show you the correct time.
Solution 3:
The normal case is that Linux systems have the RTC (real-time clock) set to UTC, and the conversion to local time is done in userspace based on time zone data and the TZ
environment variable. This is "less bad" because it keeps the system RTC monotonically increasing, and applies any time zone magic later, ensuring for example that no files will normally have a timestamp in the future (which can easily happen at least once a year, if the system RTC is set to local time). As Ken pointed out, the RTC itself has no concept of a time zone, only time.
As you have found, this causes issues when dual-booting with a system that does not normally operate that way, like the Microsoft family of operating systems which generally expect the RTC to be set to local time. Yes, Windows NT (I think going all the way back to NT 4, actually) can work with the RTC set to UTC, but at least last I looked it wasn't really a supported configuration and there were a number of caveats.
The easy solution in your case is probably to set the RTC to local time, tell your Linux system that the RTC is set to local time (the exact mechanics of doing this varies by distribution and release version, but apparently in Ubuntu you set UTC=no
in /etc/default/rcS), and then configure the operating systems such that only one of them (preferably the one you use the most, since the time displayed in all others will be incorrect twice a year until it has been booted and had a chance to correct it) handles daylight saving time changes. And live with the downsides, which should be managable on a single-user system.
You could also set the Windows side to use UTC as a time zone and turn off automatic daylight saving time changes in Windows, and keep Linux set to have the RTC in UTC and display the time converted according to its practices. However, this will cause Windows to display the date and time in UTC, which might not be what you really want. It's not a big issue for us Europeans, who are at most something like three hours off from UTC, but might be more of an issue in the US. This is likely more realistic an option if you only use Windows occasionally, and your primary OS is Linux or some other RTC-UTC-aware OS.
Solution 4:
If you dual boot and there are time conflicts between Windows and Ubuntu, this occurs because Ubuntu store the time on the hardware clock as UTC by default while Microsoft Windows stores the time as local time, thus causing conflicting times between Ubuntu and Windows.
You need to set your Linux system to use local time as explained here in this guide for Ubuntu.