Reputation: 3366
I got VirtualBox running on Windows 7 host, running Ubuntu servers and XP-SP3 clients.
Often I note that the clock on the guest machines is strictly late in comparison to the host time. I first noted it when I got wierd benchmarking results for all kind of performance tests, and assumed that compare tests on the same machine to themselves would be OK - which is not.
The situation gets worse when client-server tests are involed. It might have been acceptable if all the guests would retain the same delay, but I run into situations where the time on the XP clients is more advanced on the servers, and situation that the time on the Ubuntu servers is more advanced then on the xp clients.
In a sense I could live with that - because it presents interesting test cases - but sometimes it gets to differences of 20 minuets.
I tried fidlling with the configuration for no avail - but I aught to be missing something...
Anybody? Thanks in advance.
Upvotes: 9
Views: 11409
Reputation: 5877
If you have installed VirtualBox additions (and you probably have) there is a service on the guest host that syncs the time.
This service corrects the clock drift every 10 seconds if the difference between the host and guest clock is below 20 minutes, if the difference is above 20 minutes it just resets the guest clock to the host time. Thus you should never find a machine out of sync more than 20 minutes.
It is possible to change the 20 minute threshold using the --timesync-set-threshold
guest parameter. You could for example set it to 1000ms, so you should never find a machine with a difference above one second.
You can configure the guest --timesync-set-threshold
from the host machine using the following command:
VBoxManage guestproperty set <your-vm-name> "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000
You should restart your guest additions service or your guest machine in order for it to take effect.
Further reading:
Upvotes: 14
Reputation: 275
First make sure Windows is not restricted to use HPET only as this may prevent the host and guest(s) to get an accurate RTC source:
Open administrator cmd.exe and type bcdedit /enum
and then make sure useplatformclock
is not there, if it is type bcdedit /deletevalue useplatformclock
to remove it and then reboot Windows.
I had enabled this on my host to fix an old driver issue (some also say it's 'best' for performance with no reliable proofs), there was no noticeable issue at first but then I discovered that the RTC was drifting quite a lot (up to 0.5s per hour...).
There are also other inherent problems in Windows (possibly fixed in Windows 8) where the timer precision is set OS wise while it can be changed by any application that needs a higher precision and set back to a lower precision later. These changes will also skew the RTC over time. So the best thing to do (from my own experience) is to:
VBoxManage setextradata "VM name" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1
(you then need to shut-down the VM and restart it for this change to take effect)
install an NTP package on the guest that uses standard external time sources (like any standalone computer would).
Install a proper NTP port on the Windows host (I personally use Heiko Gerstung's)
Additionally you should make sure your virtualbox guest additions are up to date.
Upvotes: 0
Reputation: 3827
A universal solution would be to:
Regarding clock-skew with VirtualBox, has this issue with some configurations. With Windows 7 guests, disabling IO APIC helps in some cases.
Details : http://forums.virtualbox.org/viewtopic.php?f=8&t=21480
Upvotes: 2