A few things I’ve learned about time synchronization in VirtualBox

These comments may be specific to running a Debian Linux guest on a Mac OS X host.
  • Time synchronization is briefly documented in the manual in chapter 9, Advanced Topics.
  • Time synchronization is performed by an in-guest daemon called VBoxService
  • You can tune VBoxService (on the guest) by running VBoxManage on the host.  As near as I can tell, you must restart VBoxService for any changes to take effect.  (In Debian, /etc/init.d/vboxadd-service restart.  To kill it, replace “restart” with “stop”.  To start it after you’ve killed it, replace “restart” with “start”.)
  • You can watch what VBoxService does by killing the daemon (see above) and running it from the command line in verbose mode, in the foreground (as root), “VBoxService -v -f“.
  • By default, VBoxService wakes up every 10 seconds and adjusts the time.  If the time is off by less than 20 minutes, it adjusts the time by (very roughly) 0.005 seconds.  (Put another way, if your clock is slow by a whole second, it may take half an hour to catch up.)  If the time is off by more than 20 minutes, VBoxService just sets the time.
  • If you want VBoxService to just set the time when it’s off by more than 1 second (1000 ms), instead of adjusting it gradually every 10 seconds, you can say
    • VBoxManage guestproperty set <vm-name> "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000
  • The “--” in the documentation and in the command above is not a typo.
  • Remember to restart VBoxService for your changes to take effect.