The value returned by time is the number of seconds since epoch (often 0:00, Jan 1st, 1970 GMT). The number of seconds since some point in time doesn't change depending on where you happen to be located, so it's not affected by $ENV{TZ}.
Convert the value return by time into a local time (e.g. using localtime) to see the change.
Note: I think you need to call POSIX's tzset for the change to be noticed by localtime.
Note: I think changing $ENV{TZ} *after* perl starts doesn't work properly in Windows. It works fine if you change it *before* perl starts.
use POSIX qw( tzset ); print localtime(time) . " in $ENV{TZ}\n"; $ENV{TZ} = 'GMT-8'; tzset(); print localtime(time) . " in $ENV{TZ}\n";
Mon Dec 3 00:22:29 2007 in America/New_York Mon Dec 3 13:22:29 2007 in GMT-8
In reply to Re: 'time' command & $ENV{TZ}
by ikegami
in thread 'time' command & $ENV{TZ}
by needperlhelp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |