Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: ENV{TZ} and localtime? (inconsistent time in child script)

by ikegami (Patriarch)
on Sep 06, 2007 at 16:54 UTC ( [id://637478]=note: print w/replies, xml ) Need Help??


in reply to ENV{TZ} and localtime? (inconsistent time in child script)

I started looking into this, but I hit the limit of my currently available resources. I hope to look further into this tonight. Here's what I found out so far:

  • POSIX::tzset is a thin wrapper for the C library function with the same name. The entirety of the XS code is:

    void tzset()
  • Windows and Visual Studio support tzset.

  • Changes to %ENV are reflected in the process's actual environment. I used Win32::ExpandEnvironmentStrings (which is mapped to a system call that knows nothing of %ENV) to verify this.

I hope to test the example code in MSDN's tzset documentation using VS6, what ActivePerl uses.

Replies are listed 'Best First'.
Re^2: ENV{TZ} and localtime? (inconsistent time in child script)
by blahblahblah (Priest) on Sep 07, 2007 at 00:30 UTC
    Thanks, I think I found an solution in the docs you referenced for _tzset:
    Use the following syntax to set the TZ environment variable: set TZ=tzn[+ | –]hh[:mm[:ss] ][dzn] tzn Three-letter time-zone name, such as PST. You must specify the correct + offset from local time to UTC.
    So I tried "EST5EDT" instead of -0400, and that gives the right result. I'm still not sure why it behaves differently when called via system() though.

    update:used code tags so brackets in syntax aren't hidden.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://637478]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found