I asked the following question on AskUbuntu:
I’ve been noticing a peculiar issue with Ubuntu recently, in that booting to Ubuntu from Windows seems to be messing with the System time.
Eg: I shutdown Windows at 8:35pm, to boot into Ubuntu. When Ubuntu was started up, instead of showing time as 8:35 pm, it showed 3:05 pm momentarily, before setting itself to 8:35pm. If Windows is restarted after this happens, time now becomes 3:05pm (which seems to be UTC time)
If Windows alone is restarted (Meaning booting up Windows after shutting down Windows), no time fluctuation occurs. If Ubuntu is started up after Windows is shutdown, the same issue happens. Time seems momentarily UTC, and then corrected within a second or so after startup, to correct time. However the next time Windows is booted up, the time becomes the same as that which was momentarily displayed on Ubuntu. I hope I’m making this clear.
I’ve checked that my timezone is correct in Ubuntu. It is set as Asia/Kolkata. I even did a
dpkg-reconfigure tzdata, but it was already correct timezone.
My timezone is Asia/Kolkata, which is UTC+5.30 hours. The time which appears incorrectly is the correct time if my timezone was UTC. I have a Multiboot with grub2, managing Ubuntu 13.04 and Windows 8. PC is an Acer Aspire V5-121 Netbook purchased two days ago.
Correct Solution (As answered by the community of AskUbuntu):
When this happens on a dual-boot system, it’s usually because one operating system thinks the hardware clock tracks local time, while the other operating system thinks the hardware clock tracks UTC.
In your case, your hardware clock is probably set to the local time, and:
- Windows is set to use local time, which (given your time settings) is correct.
- Ubuntu is set to use UTC, which (given your time settings) is incorrect.
If you were to just reset the time in the Ubuntu system, either manually or automatically, it would then be wrong in Windows, so that’s not a good solution.
Instead, the best solution is probably to reconfigure Ubuntu to treat the hardware clock time as local time (then you can leave your Windows configuration, and your hardware clock time, alone).
To do this, edit
/etc/default/rcS as root and make sure it has
- Press Alt+F2.
gksu gedit /etc/default/rcSand press Enter.
- You’ll probably see this:
# assume that the BIOS clock is set to UTC time (recommended) UTC=yes [/code]
- If you do, change
UTC=no. (Or you might want to add a comment too, by changing it to something like
UTC=no # changed to accommodate Windows system. Everything on a line after a
#character is a comment, and is there just to make your settings more human-readable.)
- If you don't, look for any
UTC=line. If it's uncommented (i.e., doesn't have a
#at the beginning), change it accordingly. If it is commented, uncomment it by removing the leading
#and make sure it says
- If you do, change
- Save the file and quit the text editor.
- Reboot to apply your changes and check that the time is working properly now on both operating systems.
sudo hwclock --systohc --localtime
which sets the following:
0.088933 1387202722 0.000000
0.088933 1387202722 0.000000 in /etc/adjtime
which seems to be the newer method.