Page 1 of 1

Time Drift on High Sierra

Posted: 20. Apr 2018, 19:39
by artoonie
Without guest additions, how do mac guests synchronize time?

I am using a OS X Guest with gitlab to run our continuous integration, testing, and deployment. I call

Code: Select all

sudo ntpdate
on launch, but about 15 minutes later, the time jumps backwards by SEVEN hours. Any idea what the cause might be? I've checked the time config to ensure the timezone is properly set.

How do you synchronize the time on your guest OS?

Re: Time Drift on High Sierra

Posted: 20. Apr 2018, 19:42
by socratis
We're going to need to see a VM log from a complete VM run:
  • Start the VM from cold-boot (not from a paused or saved state) / Observe error / Shutdown the VM (force close it if you have to).
  • With the VM completely shut down (not paused or saved), right-click on the VM in the VirtualBox Manager and select "Show Log".
  • Save only the first "VBox.log", ZIP it and attach it to your response. See the "Upload attachment" tab below the reply form.

Re: Time Drift on High Sierra

Posted: 21. Apr 2018, 09:18
by mpack
artoonie wrote:Without guest additions, how do mac guests synchronize time?
You mean, how do PCs correct for clock drift? They use a network time server. They might also recheck the onboard real time clock (RTC) chip.

VirtualBox emulates the hardware of a PC, that includes the emulation of a real time clock. I have no idea how often OS X checks the RTC, but if you have a time gap between the host and guest then that might explain the symptoms.

Total guess: you have the time zone of the guest set differently to that of the host. When the guest reads UTC from the host, it sets local time from it. Trying to force local time to be the same when they are supposed to be 7 hours apart would be the source of the problem.

Re: Time Drift on High Sierra

Posted: 21. Aug 2018, 17:42
by vbox_macos
Does the time on the VM always jump back seven hours, or does it jump back to when you created the currently used snapshot?

I have made a cronjob on my macos guest that syncs the time every 30 seconds:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>workaroundAgainstJumpingTime</string>
	<key>ProgramArguments</key>
	<array>
		<string>sudo</string>
		<string>ntpdate</string>
		<string>-u</string>
		<string>de.pool.ntp.org</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardErrorPath</key>
	<string>/tmp/workaroundAgainstJumpingTime.stderr</string>
	<key>StandardOutPath</key>
	<string>/tmp/workaroundAgainstJumpingTime.stdout</string>
	<key>StartInterval</key>
	<integer>30</integer>
</dict>
</plist>

Re: Time Drift on High Sierra

Posted: 21. Aug 2018, 19:02
by socratis
vbox_macos wrote:I have made a cronjob on my macos guest that syncs the time every 30 seconds:
vbox_macos, is your OSX guest a true OSX guest or not? I'm more inclined to bet that it's a Hackintosh, given your previous (now locked) thread.

Because the truth of the matter is that I have all OSX host from 10.5 onward, and I've never had the need to manually adjust the time as long as there's network. They can do it just fine without manual intervention. As long as they're legit, and not hacked...