jaldhar has asked for the wisdom of the Perl Monks concerning the following question:
Does anyone have a clue how to do this? On Linux I can do this:
BEGIN { $ENV{TZ} = 'UTC'; } say scalar localtime;
...and localtime will give me the time in UTC. However win32 (Windows Vista with strawberry Perl 5.10.1 to be precise) steadfastly refuses to give me anything except the local time. Though funnily enough, if I do:
...at the windows command prompt, then print scalar localtime will be in UTC. So there has to be some way to do this in perl but what is it?set TZ="UTC"
(Some background. My module Module::Starter::Plugin::CGIApp creates a bunch of files. One of these has a time stamp created with localtime. In my test suite I compare the modules output against a set of known good files. However as the value of localtime keeps changing, I need to force a fixed time in the test script. I use Test::MockTime for this which almost works except for this time zone issue.)
--
જલધર
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to set a processes notion of the timezone on win32?
by jaldhar (Vicar) on Mar 02, 2010 at 18:34 UTC | |
by Anonymous Monk on Mar 02, 2010 at 23:59 UTC | |
Re: How to set a processes notion of the timezone on win32?
by banesong (Acolyte) on Mar 02, 2010 at 17:46 UTC | |
Re: How to set a processes notion of the timezone on win32?
by ambrus (Abbot) on Mar 03, 2010 at 14:06 UTC | |
Re: How to set a processes notion of the timezone on win32?
by almut (Canon) on Mar 02, 2010 at 17:39 UTC |