On 1 Oct 2003 10:27:46 -0700, Jon <> wrote:
> While doing some time/date functions I had to change the timezone used
> (by changing the ENV{TZ}) twice in one script. However, it seems the
> kernel cached the last zone and failed to open or change to the new
> one. I confirmed this using strace, as you could see it only opened
> the one file. The code I used is as follows.
>
> $ENV{TZ} = ':/usr/share/zoneinfo/Europe/London';
>
> $time = time();
>
> ($sec,$min,$hour,$day,$mon,$this_year,$wday,$yday, $isdst) =
> localtime($time);
> print "$hour:$min\n";
>
> $ENV{TZ} = ':/usr/share/zoneinfo/Europe/Paris';
>
> ($sec,$min,$hour,$day,$mon,$this_year,$wday,$yday, $isdst) =
> localtime($time);
> print "$hour:$min\n";
>
> Is the code I used. The times should be out by an hour (Paris is one
> hour ahead of London), however for me they both show the same time,
> which is within the London (GMT+1) timezone. The results were
> different on another server.
>
> Linux 2.4.20 complied from source, Perl 5.8.0 (RedHat RPM) - failed.
> Linux 2.4.7 RedHat supplied, Perl 5.6.0 (RedHat RPM) - worked.
man tzslect (to see what to use for TZ). Try:
$ENV{TZ} = 'Europe/London';
$time = time();
print scalar localtime($time)."\n";
$ENV{TZ} = 'Europe/Paris';
print scalar localtime($time)."\n";
--
David Efflandt - All spam ignored
http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/