//burnz.blog

Fix date and time in Ubuntu

June 20, 2008 · 14 Comments

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 :-

  1. 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
  2. Then update the hardware clock accordingly, and force this to be considered “localtime”:
    user@server:~$ sudo /sbin/hwclock --systohc --localtime
  3. Check to make sure it looks right:
    user@server:~$ sudo /sbin/hwclock --localtime
  4. 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.

Categories: Linux / Unix · Tutorial
Tagged: , , ,

14 responses so far ↓

Leave a Comment