Bootcamp Time Difference Between Mac OS And Windows

This is what you need to do in order to fix the time when booting in Mac OS:

1. Create new file /sbin/localtime-toggle with the following contents:

#!/bin/sh

to_utc() {
echo "localtime-toggle: Toggling to UTC."
date -f %m%d%H%M%Y `date -u +%m%d%H%M%Y`
}

to_localtime() {
echo "localtime-toggle: Toggling to localtime."
date -u -f %m%d%H%M%Y `date +%m%d%H%M%Y`
}

trap 'to_localtime; exit' term
to_utc
{ while true; do sleep 86400; done; } &
wait

2. Ensure that localtime-toggle is executable:

chmod +x /sbin/localtime-toggle

3. Create new file /System/Library/LaunchDaemons/org.osx86.localtime-toggle.plist with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Label</key>
   <string>org.osx86.localtime-toggle</string>
   <key>Program</key>
   <string>/sbin/localtime-toggle</string>
   <key>KeepAlive</key>
   <true/>
   <key>RunAtLoad</key>
   <true/>
   <key>HopefullyExitsFirst</key>
   <true/>
</dict>
</plist>

4. Reboot.
At this point, your computer’s clock should correctly be set to UTC as Leopard boots, and reset back to local time as Leopard shuts down.

1 Comment

  1. A less-intrusive solution is to set a registry setting in Windows to allow it to use a UTC system clock:

    http://superuser.com/questions/185773/does-windows-7-support-utc-as-bios-time

    This way it will work in both Windows and Mac without any further alteration (albiet with a known bug during daylight saving changeover).

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.