Dual-booting with Ubuntu and Windows sometimes giving a problem with date and time in Ubuntu. This is a well-established problem when dual-booting, since Linux assumes the hardware clock represents UTC, whereas Windows assumes the hardware clock represents local time. Luckily Linux provides ways to change this to fix it.
If you go into your clock settings, I think you can select between setting the hardware as either UTC or local time. Try switching that, and then adjust the time and see if it “sticks.”
If not, you can do this via the commandline in Linux :-
- In Linux, set the date and time to what it currently is. For example if it’s 10:20am local time:
user@server:~$ sudo date -s 10:20
- Then update the hardware clock accordingly, and force this to be considered “localtime”:
user@server:~$ sudo /sbin/hwclock --systohc --localtime
- Check to make sure it looks right:
user@server:~$ sudo /sbin/hwclock --localtime
- Sync between hardware clock and system clock:
user@server:~$ sudo /sbin/hwclock --hctosys --localtime
Now Linux should consider the clock to be “localtime”, which should be identical to what Windows is doing. So after rebooting into Windows, the time should look right.
Hope that helps.






14 responses so far ↓
diani // June 21, 2008 at 6:38 pm
Got similar problem, thanks, I will try it later. Save your post for now since I’m at my office currently. Thanks again.
burnz // June 23, 2008 at 9:36 am
I hope it will fix your problem…
oldcity // June 24, 2008 at 6:47 am
1. Changed BIOS to boot Ubuntu 8.04
2. Fresh boot showed correct time.
3. Followed your instructions.
3a. sudo /sbin/hwclock –show displayed correct time
4. Did restart and accessed BIOS the clock was plus 4 hours.
5. Reset time with reboot.
6. Reboot showed correct time.
7.Using sudo /sbin/hwclock –show displayed time minus 4 hours.
Tried many variations with no success.
hth
oldcity
oldcity // June 24, 2008 at 6:49 am
Re above booted from using Vista.
burnz // June 24, 2008 at 1:54 pm
oldcity: have you try update your time with ntp server.
oldcity // June 24, 2008 at 8:47 pm
will advise in on Monday.
pippo // December 15, 2008 at 5:28 pm
This worked for me – thanks.
ershovis // June 17, 2009 at 2:54 pm
Greate!
TEHEK // June 22, 2009 at 8:14 am
Thx!
Didnt notice the importance of this stuff until MySQL and PHP surprised me with displaying different time
SELECT CURRENT_TIMESTAMP
// 2009-06-22 8:00:00
Seneriz // July 6, 2009 at 11:57 pm
eeepp…,
Mantlow // July 7, 2009 at 12:07 am
showing some love,
Buelz // July 7, 2009 at 12:07 am
hey thanks for the add I love all your stuff,
Summerbile // July 7, 2009 at 12:07 am
hey thanks for the add I love all your stuff,
Puhlander // July 7, 2009 at 12:07 am
i love your work!,