Comment 2 for bug 347303

Revision history for this message
jsteel (jon-steel) wrote :

So it looks like its a bug with perl.

perl -v
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi

When you call localtime for the first time it picks up the ENV{TZ} value and remembers it. Every time you call localtime after, it will use that old value for the TZ. The only way to change it would be to do something like the following:

sub mylocaltime
{
my $t = shift;
return split / /, `perl -le 'print join(" ",localtime($t))'`
}
my $time = time;
print "time = $time\n";

print "TZ = $ENV{TZ}\n";
print "$_ " for mylocaltime($time);

$ENV{TZ}='US/Central';
print "TZ = $ENV{TZ}\n";
print "$_ " for mylocaltime($time);

I guess I'll just install a newer version of perl :)