Setting the date and time on a guest to an arbitrary value

Discussions about using Windows guests in VirtualBox.
Post Reply
rossmcm
Posts: 25
Joined: 18. Nov 2010, 21:23
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP

Setting the date and time on a guest to an arbitrary value

Post by rossmcm »

This question has been asked before, but the solutions given seem somewhat clunky, and I'm wondering if there is a simpler way.

I want to test an app's behaviour during transitions in and out of daylight savings time. I therefore want to be able to set the date and time of a VM, (preferably from the Control Panel applet, but from a batch file is fine) and not have it "corrected" ti the host's time for me.

I see that time synchronization with the host is achieved via the guest additions. I don't want to give up all of those features in order to stop the time being synchronized. There seems to be no way to disable an individual feature of the guest additions, so I'm wondering if I can use the options for tuning --timesync to do this.

E.g. is there come combination of --timesync-interval, --timesync-min-adjust, --timesync-set-start, --timesync-set-on-restore which will allow me to set the date and time to a specific value and then not adjust it ever again (or until a very long time has elapsed)?

Then I can have several batch files that I can run to set to time and date to a series of dates near the daylight transition times.

Help!
TIA
Ross
rossmcm
Posts: 25
Joined: 18. Nov 2010, 21:23
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP

Re: Setting the date and time on a guest to an arbitrary val

Post by rossmcm »

Found the answer in elsewhere in this forum. Bearing in mind the problem is not one of being unable to set the date (that's easy), but one of retaining the new date without VB re-sync-ing from the host.

The answer is here: viewtopic.php?t=8535
This can now be done using VBoxManage utility. It's a command-line tool, which is available in the Virtualbox install folder in Windows or in ~/Library/Virtualbox on Mac.

Turn off time syncing:
vboxmanage setextradata [VMname] "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"

Turn it back on:
vboxmanage setextradata [VMname] "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "0"

note: [VMname] is the name of your virtual machine.
Worked for me under WinXP. The main problem is that without sync to the host the time drifts - I had 2 XP VMs running overnight and one kept time, the other one lost about 4 hours. Luckily in this application (testing behaviour over day transitions) it's not a big issue.

R
Post Reply