Set the 'bios' time of the virtual box.

Discussions about using Windows guests in VirtualBox.

Set the 'bios' time of the virtual box.

Postby trenien » 7. Jun 2007, 17:05

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?
trenien
 
Posts: 8
Joined: 5. Jun 2007, 01:24

Postby bodhi.zazen » 7. Jun 2007, 17:59

The time is correct on my windows guest after installing the additions.
If is a virtual machine, is it still broken ?
bodhi.zazen
Volunteer
 
Posts: 180
Joined: 17. May 2007, 16:02

Postby trenien » 8. Jun 2007, 01:18

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?
trenien
 
Posts: 8
Joined: 5. Jun 2007, 01:24

Postby achimha » 8. Jun 2007, 08:24

You can set a time offset in VBox 1.4.0:

Code: Select all   Expand viewCollapse view
VBoxManage modifyvm <name> -biossystemtimeoffset <msec>
achimha
Volunteer
 
Posts: 217
Joined: 10. May 2007, 09:24

Postby trenien » 9. Jun 2007, 04:06

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   Expand viewCollapse view
VBoxManage modifyvm <name> -biossystemtimeoffset <-msec>
trenien
 
Posts: 8
Joined: 5. Jun 2007, 01:24

Postby achimha » 9. Jun 2007, 10:50

Exactly. Not all features of VirtualBox are documented. There are just too many features to document them all :-)
achimha
Volunteer
 
Posts: 217
Joined: 10. May 2007, 09:24

Postby trenien » 12. Jun 2007, 03:24

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?
trenien
 
Posts: 8
Joined: 5. Jun 2007, 01:24

Postby siking » 18. Sep 2008, 17:55

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
siking
 
Posts: 2
Joined: 18. Sep 2008, 17:50
Location: California

Postby chungy » 19. Sep 2008, 12:27

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.
chungy
Volunteer
 
Posts: 132
Joined: 26. Jan 2008, 10:27

Postby siking » 20. Sep 2008, 00:49

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   Expand viewCollapse view
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.
siking
 
Posts: 2
Joined: 18. Sep 2008, 17:50
Location: California

Postby asteriosgr » 27. Sep 2008, 12:27

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

Handy Perl script

Postby Higg's bosun » 10. Oct 2008, 22:41

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=Date%3A%3AManip&mode=all

Code: Select all   Expand viewCollapse view
#!/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
Higg's bosun
 
Posts: 1
Joined: 10. Oct 2008, 21:49

How To Set The Virtual Bios Date Manually?

Postby gungadout » 20. Nov 2008, 06:02

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
gungadout
 
Posts: 1
Joined: 20. Nov 2008, 05:38

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

Postby bismutant » 16. Jun 2009, 11:12

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?
bismutant
 
Posts: 2
Joined: 16. Jun 2009, 10:57
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Win XP

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

Postby vbox4me2 » 16. Jun 2009, 13:10

Time is kept ontime by the Guest Additions, remove them to set your own time.
vbox4me2
Volunteer
 
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam

Next

Return to Windows Guests

Who is online

Users browsing this forum: No registered users and 15 guests