VirtualBox host and virtual machine time getting out of sync

Monday, January 25, 2016
I ran into a very interesting problem recently, which had me stumped for a while.  I had a VirtualBox (version 5.0.10) host with 2 virtual machines running on it.  For some reason the guests clocks would get out of sync with the host.  While this might not seem like an annoying problem, some of the programs that I was running were time-sensitive.  This was an issue that I wanted to fix.

Both my host and virtual machines were running Ubuntu 14.04 LTS with the latest patches.

Now, I have solved this problem and the clocks appear to stay in sync now.  Here is what I did to make it work.

First, I will say that I already did have the VirtualBox Guest Additions compiled and I verified that their kernel modules were loaded.

To solve this clock problem, I ended up adding additional configuration parameters, using the following syntax:
VBoxManage setextradata "VM Name" "parameter" "value"
The parameters and values that I found when searching on Google were a bit difficult to find.  It turns out that the documentation was right in the VirtualBox manual Chapter 9 but I originally didn't understand what that meant.

Here are the values that I added to my virtual machine that made the time synchronization work:

Key: /VirtualBox/GuestAdd/VBoxService/timesync-set-start, Value: 1
Key: /VirtualBox/GuestAdd/VBoxService/timesync-set-threshold, Value: 60000
Key: VBoxInternal/GuestAdd/VBoxService/timesync-interval, Value: 10000
Key: VirtualBox/GuestAdd/VBoxService/timesync-set-start, Value: 1
Key: VirtualBox/GuestAdd/VBoxService/timesync-set-threshold, Value: 60000

I am almost convinced that some of those key value names are incorrect - but I couldn't figure out which ones caused the clocks to say in sync and which were extra.