Page 1 of 2

Set the 'bios' time of the virtual box.

Posted: 7. Jun 2007, 17:05
by trenien
Under a linux host, I have a need to install XP and set it back in time from the start. Unfortunately, whatever I've been trying with Windows, it always gets back to the time settings of the host.

Since I was careful to uncheck the internet time server synchro, I guess XP sets its time directly from what it extracts from the bios.

Is there a way to set the virtual bios to a chosen date?

Posted: 7. Jun 2007, 17:59
by bodhi.zazen
The time is correct on my windows guest after installing the additions.

Posted: 8. Jun 2007, 01:18
by trenien
You misunderstand me. I don't want the virtual XP time to be correct, I want it to be set on whatever I choose it to be.
I just realized that among the additions there's a sync tool. That don't help, on the contrary.

So my question becomes: Is there a way to set the virtual bios time on a time and date of my choice, and can I have the additions installed with that sync tool deactivated somehow?

Posted: 8. Jun 2007, 08:24
by achimha
You can set a time offset in VBox 1.4.0:

Code: Select all

VBoxManage modifyvm <name> -biossystemtimeoffset <msec>

Posted: 9. Jun 2007, 04:06
by trenien
Thanks. That's exactly the kind of thing I was looking for - but knowing I have to set it back about 2 years in millisecond :shock: .

It isn't really documented in the user manual though. I could only find it mentionned at the beginning of the quick reference section: to set it back in time, do I just have to use it with a minus in front?

Code: Select all

VBoxManage modifyvm <name> -biossystemtimeoffset <-msec>

Posted: 9. Jun 2007, 10:50
by achimha
Exactly. Not all features of VirtualBox are documented. There are just too many features to document them all :-)

Posted: 12. Jun 2007, 03:24
by trenien
Ok, I just did it and it works perfectly.

Related question: If I define another offset afterward with the same command, does it replace the previous one, or is it added to it?

Posted: 18. Sep 2008, 17:55
by siking
Old post, still a problem.

To answer the last poster, the time is replaced, not added. Which leads to my problem: how many milliseconds between $NOW and November 02, 2008 2AM PST? :( In case you're wondering: I am testing what happens to my stuff during daylight savings time change.

TIA

Posted: 19. Sep 2008, 12:27
by chungy
A little math goes a long way... 11 days left in September, 31 in October, and another day for getting to midnight Nov 02. You should be able to figure it out from here, add/subtract hours as necessary.

Posted: 20. Sep 2008, 00:49
by siking
When I posted my question there were 12 days left in September. what about next week, what about next month, ...? In short: I was hoping for something generic. Something like the following:

Code: Select all

vboxdate () {
	# Adjust VM BIOS time to a given date
	secs=$(date –date "$*" +%s)    # convert supplied date to secs, since 1970-01-01
	let secs-=$(date +%s)           # subtract the date NOW
	msecs=$(( $secs * 1000 ))       # convert to millis
	echo Adjusting time ${msecs}ms
	VBoxManage modifyvm Vista -biossystemtimeoffset ${msecs};
 }
Sorry, but I can't help anyone on Windows.

Posted: 27. Sep 2008, 12:27
by asteriosgr
what you mean by saying VBoxManage modifyvm <name> -biossystemtimeoffset <-msec>
and i need help on setting bios in 27 august 2003....any1 help please???

Handy Perl script

Posted: 10. Oct 2008, 22:41
by Higg's bosun
Here's a perl script I use. You may not have the Date::Manip module in your distribution, but you can get it from http://search.cpan.org/search?query=Dat ... p&mode=all

Code: Select all

#!/usr/bin/perl -w
use strict;
use Date::Manip;

my $start = join(' ', @ARGV);
my $sdate = ParseDate($start);
my $edate = ParseDate("now");
my $sepoch = UnixDate($sdate, "%s");
my $eepoch = UnixDate($edate, "%s");
my $msec = -1000 * ($eepoch - $sepoch);

print "Something like:\nVBoxManage modifyvm <name> -biossystemtimeoffset $msec\n";
$ perl msec.pl 6:30 PM 27 august 2003
Something like:
VBoxManage modifyvm <name> -biossystemtimeoffset -161636563000
$
Date::Manip has awesome parsing:
$ perl msec.pl 2 days ago
Something like:
VBoxManage modifyvm <name> -biossystemtimeoffset -172800000
$
If you get "Use of uninitialized value in subtraction (-) at msec.pl line 11.", you've gone past Date::Manip's awesomeness:
$ perl msec.pl next year
Use of uninitialized value in subtraction (-) at msec.pl line 11.
Something like:
VBoxManage modifyvm <name> -biossystemtimeoffset -1223670094000
$
Cheers,
HB

How To Set The Virtual Bios Date Manually?

Posted: 20. Nov 2008, 06:02
by gungadout
Hi Folks,

The examples I've seen in the forum, seem to require programming an instruction into a php program or the like, then running that program. I am not familiar with that environment, so I cannot use that procedure.

Is there any way I can set the date manually?

Regards,

Gungadout

Re: Set the 'bios' time of the virtual box.

Posted: 16. Jun 2009, 11:12
by bismutant
hello, I agree with "gungadout"! Why isn`t there any simple way to freeze the time of a VM? Even if you end the Windows service W32time and uncheck time synchronisation with microsoft server the time is synchronisized...but fromthe bios? isn´t the bios freezed too like the operating system?

Re: Set the 'bios' time of the virtual box.

Posted: 16. Jun 2009, 13:10
by vbox4me2
Time is kept ontime by the Guest Additions, remove them to set your own time.