Fixing time sync when dualbooting macOS and Windows

May 19th, 2020

Due to differences in how Windows and macOS store time on the hardware clock, the time will be incorrect when dualbooting between the two OSes (unless you live in the UTC timezone!). Fixing it is just a matter of syncing the clock when the OS starts.

Windows

Right click the start button and click run. Enter services.msc and click enter to open the services manager. Find the Windows time service named w32time, doubleclick it, and change the startup type to be automatic.

MacOS

Put the following plist in the file /Library/LaunchDaemons/com.zerowidth.launched.timesync.plist.

You will likely have to use sudo nano /Library/LaunchDaemons/com.zerowidth.launched.timesync.plist to edit the file as root.

<!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>com.zerowidth.launched.timesync</string>
	<key>ProgramArguments</key>
	<array>
		<string>sh</string>
		<string>-c</string>
		<string>sntp -sS time.apple.com</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>

This plist was created using the launchd plist generator over at zerowidth. It runs the command sntp -sS time.apple.com on boot, which syncs the local time with the Apple time servers.