Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: TimeZoning oddities

by robin (Chaplain)
on Nov 02, 2005 at 12:13 UTC ( #504901=note: print w/replies, xml ) Need Help??


in reply to TimeZoning oddities

You can fix the problem by calling POSIX::tzset() after changing $ENV{TZ}.

It could be that this is the way it's supposed to work, and it's not a bug at all; although the behaviour is certainly inadequately documented and inconsistent. (BTW: the bug I was referring to is here, but I think it's not quite the same problem.)

Replies are listed 'Best First'.
Re^2: TimeZoning oddities
by JPaul (Hermit) on Nov 02, 2005 at 15:14 UTC
    Nuts!

    I saw that in one of the PODs I was reading through - but since all the examples I had found (including on PM) did not include it, I assumed that it was not really necessary. Doofus.

    Thank you very much, this does the magic.

    -- Alexander Widdlemouse undid his bellybutton and his bum dropped off --

      At last I have found the definitive answer! The problem is with localtime rather than strftime.

      This problem happens only on Linux, and only with a threaded build of perl. There's some disgreement about whether the bug is in Linux or perl, but in either case a manual call to tzset is a good workaround.

      See the bug report and ensuing discussion here.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://504901]
help
Chatterbox?
[stevieb]: it's a reminder to re-inforce it :P
[atcroft]: james28909: That particular questions was a bit of trick, actually (depending on the country you are in). More interesting is, if you are trying to subtract from an epoch time, for instance, you might have to consider when/if DST occurs for a location,
[atcroft]: because you may have to adjust the number of seconds you change from an epoch from 86400 (not to mention leap seconds)....
[atcroft]: james28909: Although if your program is using a database, you might be able to "pass the buck" to the database and ask it to do the date change for you....
[stevieb]: ++ atcroft

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2017-04-29 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (531 votes). Check out past polls.