Time Drift on High Sierra

Discussions about using Mac OS X guests (on Apple hardware) in VirtualBox.
Post Reply
artoonie
Posts: 1
Joined: 20. Apr 2018, 19:35

Time Drift on High Sierra

Post 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?
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Time Drift on High Sierra

Post 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.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Time Drift on High Sierra

Post 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.
vbox_macos
Posts: 2
Joined: 11. Jul 2018, 14:34

Re: Time Drift on High Sierra

Post 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>
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Time Drift on High Sierra

Post 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...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply