Discussion:
How to start always with same system time (VPC 2007 SP1)
(too old to reply)
Christian Zimmermann
2012-01-26 14:40:22 UTC
Permalink
Hello.

I'm developing software and I want to test it in a virtual system with a
special system time. So, every time I start the virtual system I want it
to start with a certain given system time.

I already know how to disable host time synchronisation. Of course this
precondition is done. But how can I automatically set a certain system
time as start time for the virtual machine? Is there a special XML tag
to set in the .vmc file I don't know?

I don't want to do that manually in the vm's bios every time I start it.

Greets,

Christian
MikeD
2012-01-26 16:53:05 UTC
Permalink
Post by Christian Zimmermann
Hello.
I'm developing software and I want to test it in a virtual system with a
special system time. So, every time I start the virtual system I want it
to start with a certain given system time.
I already know how to disable host time synchronisation. Of course this
precondition is done. But how can I automatically set a certain system
time as start time for the virtual machine? Is there a special XML tag to
set in the .vmc file I don't know?
I don't want to do that manually in the vm's bios every time I start it.
There's no way that I know of to do this. But since you're a developer, why
don't you just write a little utility to set the system time to whatever you
want it to be and run that utility at startup (either from the Registry or
from Start Menu's Startup group)?

Mike
MikeD
2012-01-26 17:02:43 UTC
Permalink
Post by MikeD
Post by Christian Zimmermann
Hello.
I'm developing software and I want to test it in a virtual system with a
special system time. So, every time I start the virtual system I want it
to start with a certain given system time.
I already know how to disable host time synchronisation. Of course this
precondition is done. But how can I automatically set a certain system
time as start time for the virtual machine? Is there a special XML tag to
set in the .vmc file I don't know?
I don't want to do that manually in the vm's bios every time I start it.
There's no way that I know of to do this. But since you're a developer,
why don't you just write a little utility to set the system time to
whatever you want it to be and run that utility at startup (either from
the Registry or from Start Menu's Startup group)?
Mike
Actually, you don't even need to write such a utility. Just create a batch
file to run the Date command line.
Christian Zimmermann
2012-01-27 10:39:51 UTC
Permalink
Yes, thank you. I already thought about such a solution. But it's very
(too) late in the booting process, because I cannot assure that such a
script or a program is started before any service. If there is no tag
for that then it would be necessary to manipulate directly the .vhd file
where the vm system time and date is stored. But where and how?

Thanks for your help.

Christian
Post by MikeD
Post by Christian Zimmermann
Hello.
I'm developing software and I want to test it in a virtual system
with a special system time. So, every time I start the virtual system
I want it to start with a certain given system time.
I already know how to disable host time synchronisation. Of course
this precondition is done. But how can I automatically set a certain
system time as start time for the virtual machine? Is there a special
XML tag to set in the .vmc file I don't know?
I don't want to do that manually in the vm's bios every time I start it.
There's no way that I know of to do this. But since you're a
developer, why don't you just write a little utility to set the system
time to whatever you want it to be and run that utility at startup
(either from the Registry or from Start Menu's Startup group)?
Mike
Actually, you don't even need to write such a utility. Just create a
batch file to run the Date command line.
MikeD
2012-01-27 11:35:45 UTC
Permalink
Post by Christian Zimmermann
Yes, thank you. I already thought about such a solution. But it's very
(too) late in the booting process, because I cannot assure that such a
script or a program is started before any service. If there is no tag for
that then it would be necessary to manipulate directly the .vhd file where
the vm system time and date is stored. But where and how?
I'm assuming you only need to do this for debugging/testing purposes
(because otherwise it'd be a very bad thing to be changing the system
date/time). So, can you just hard-code a substitute for the system date for
that purpose only?

The other thing you can do, which I just verified, is change the date and
time of your host OS. It appears the guest OS simply uses that date and
time. I changed the host OS's date to 01/01/2012 and then started a WinXP VM
and sure enough, it also had a date of 01/01/2012. Furthermore, I then reset
the host OS date to the correct date and the guest OS automatically reset
its date to match. Granted, that means you still need to manually change the
system date of the host, but from what I can see, that may be your only
option.

Mike
Christian Zimmermann
2012-01-27 15:26:53 UTC
Permalink
Post by MikeD
Post by Christian Zimmermann
Yes, thank you. I already thought about such a solution. But it's very
(too) late in the booting process, because I cannot assure that such a
script or a program is started before any service. If there is no tag
for that then it would be necessary to manipulate directly the .vhd
file where the vm system time and date is stored. But where and how?
I'm assuming you only need to do this for debugging/testing purposes
(because otherwise it'd be a very bad thing to be changing the system
date/time). So, can you just hard-code a substitute for the system date
for that purpose only?
Not really, because the system time is retreived at some positions in
the software. The effort to change this is to high for this purpose and
to riskful not to forget one query (additionally to change it back). A
central function to call which retrieves the system date and time would
not be surely considered by every developer.
Post by MikeD
The other thing you can do, which I just verified, is change the date
and time of your host OS. It appears the guest OS simply uses that date
and time. I changed the host OS's date to 01/01/2012 and then started a
WinXP VM and sure enough, it also had a date of 01/01/2012. Furthermore,
I then reset the host OS date to the correct date and the guest OS
automatically reset its date to match. Granted, that means you still
need to manually change the system date of the host, but from what I can
see, that may be your only option.
Uurgh ;-)

Christian

Loading...