Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Time zones

by Duco (Sexton)
on Sep 27, 2004 at 23:48 UTC ( [id://394411] : note . print w/replies, xml ) Need Help??


in reply to Re^3: Time zones
in thread Time zones

This code won't work on all systems. The C library may cache the timezone information between calls to localtime(3). If you set the TZ environment variable, you need to call tzset(3), which is avilable in the POSIX Perl module.
use POSIX; print scalar(localtime),"\n"; { local $ENV{'TZ'} = 'AST4ADT'; POSIX::tzset; print scalar(localtime),"\n"; } POSIX::tzset; print scalar(localtime),"\n";