Why does time change in Ubuntu after installing Windows [duplicate]
Today I was installing Windows 7 on the same computer I have Ubuntu. For some reason, after installing Windows 7 and going back to Ubuntu the time went from the correct hour at that moment, 12:30PM to 7:30AM. This happened after installing Windows 7. For what I understand the BIOS has a time set, Ubuntu has the same time that is shown in the BIOS when installing it. At least up to this point is what I have seen. Now after installing Windows 7 (And believe me this is only for testing the performance of Windows 7 against Ubuntu in which case Windows 7 is falling behind a lot on the same hardware) the time changes in Ubuntu to the wrong one that is set in Windows 7.
I actually do not change the time in Windows 7 since this is one of the checks I am doing to see if the operating system can correctly grab the time. Windows 7 fails. Ubuntu does not BUT Windows 7 actually changes the time for Ubuntu if I boot with it afterwards.
So my question is, why/how does time change in Ubuntu after installing Windows.
NOTE - I have set Ubuntu time to "manual" instead of grabbing it from the Internet just to test out this.
Because of the way the two operating systems set the hardware clock. by Default ubuntu uses UTC, and windows localtime.
So when you shut down, your hard ware clock is set to say "13:00". When you boot, windows sees "13:00" as localtime, so 1 PM, but Ubuntu sees that as UTC and so converts the time back from UTC to local time.
You can fix this by either asking windows to set the hardware clock with UTC, or Ubuntu to use localtime.
to make the change in Ubuntu, edit edit /etc/default/rcS
and change
UTC=yes
to no, like this:
# assume that the BIOS clock is set to UTC time (recommended)
UTC=no
See:
https://help.ubuntu.com/community/UbuntuTime#Multiple_Boot_Systems_Time_Conflicts
This has to deal with hardware clock being set to UTC (GMT). Ubuntu Correctly reads the local time by adding/subtracting time from your local clock. Windows does not use UTC and thus messes up the time. Have a look https://help.ubuntu.com/community/UbuntuTime
Though the documentation is old, it is still relevant.
If you have Windows 7 and have installed Service Pack 2, you can use a registry hack to set Windows to use UTC. If you need the registry hack, make sure you get it from the Microsoft website. If you don't know what this means, use the UTC=no
method in /etc/default/rcS
in the answer from Bodhi Zazen.
I don't know about Windows 8, though.