Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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:

set TZ="UTC" 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?

(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.)


In reply to How to set a processes notion of the timezone on win32? by jaldhar

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2018-05-25 15:18 GMT
    Find Nodes?
      Voting Booth?