Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Difficult on use time

by ikegami (Pope)
on Apr 07, 2012 at 21:31 UTC ( #963946=note: print w/ replies, xml ) Need Help??


in reply to Difficult on use time

In the directory identified by

perl -V:sitelib

Add the following to sitecustomize.pl

require POSIX; $ENV{TZ} = 'UTC'; POSIX::tzset(); 1;

(Create it if it doesn't exist.)


Comment on Re: Difficult on use time
Select or Download Code
Re^2: Difficult on use time
by exilepanda (Monk) on Apr 08, 2012 at 17:19 UTC
    Thanks for introducing me the sitecustomize.pl. This is new for me to notice! However, could you explain a little for what purpose of this work is supposed to be done ? Though, still can't do the trick I want. what I would expect is :
    $tm = time; @gmt = gmtime ( $tm ) ; @local = localtime ( $tm ); # and @gmt should identical to @local
    This could happen if I change my system tz to GMT+0

      They are identical

      $tm=time; print scalar(gmtime($tm)), "\n"; print scalar(localtime($tm)), "\n"; require POSIX; $ENV{TZ} = 'UTC'; POSIX::tzset(); print scalar(gmtime($tm)), "\n"; print scalar(localtime($tm)), "\n";
      Sun Apr 8 21:29:55 2012 Sun Apr 8 17:29:55 2012 Sun Apr 8 21:29:55 2012 Sun Apr 8 21:29:55 2012
        Oops... Sorry that's my fault again... what I think if I am working in GMT+0.. besides the gmt time and localtime goes the same, I would expect the return time is local time based.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-09-21 02:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (165 votes), past polls