Amdes has asked for the wisdom of the Perl Monks concerning the following question:

Monks, please help.

I am trying to convert 3 epoch times to various other timezones and I can't understand why incorrect times are being displayed for Europe/Paris and Europe/Warsaw during winter time. Can you explain this please?

PERL
#!/opt/perl/5.8.0/bin/perl use Time::Local; use strict; my $nowTime = time; my $winTime = timegm (0, 0, 9, 1, 0, 107); my $sumTime = timegm (0, 0, 9, 1, 6, 107); foreach my $e ($nowTime, $winTime, $sumTime) { foreach ("UTC","GB-Eire","Europe/London","CET","Europe/Warsaw","Euro +pe/Paris") { $ENV{TZ} = $_; print scalar localtime($e), " $ENV{TZ}"; print " (DST)" if ((localtime($e))[8]); print "\n"; } print "\n"; }
OUTPUT
Thu Sep 20 19:53:10 2007 UTC Thu Sep 20 20:53:10 2007 GB-Eire (DST) Thu Sep 20 20:53:10 2007 Europe/London (DST) Thu Sep 20 21:53:10 2007 CET (DST) Thu Sep 20 21:53:10 2007 Europe/Warsaw (DST) Thu Sep 20 21:53:10 2007 Europe/Paris (DST) Mon Jan 1 09:00:00 2007 UTC Mon Jan 1 09:00:00 2007 GB-Eire Mon Jan 1 09:00:00 2007 Europe/London Mon Jan 1 10:00:00 2007 CET Mon Jan 1 09:00:00 2007 Europe/Warsaw Mon Jan 1 09:00:00 2007 Europe/Paris Sun Jul 1 09:00:00 2007 UTC Sun Jul 1 10:00:00 2007 GB-Eire (DST) Sun Jul 1 10:00:00 2007 Europe/London (DST) Sun Jul 1 11:00:00 2007 CET (DST) Sun Jul 1 11:00:00 2007 Europe/Warsaw (DST) Sun Jul 1 11:00:00 2007 Europe/Paris (DST)

Replies are listed 'Best First'.
Re: $ENV{TZ} and localtime
by shmem (Chancellor) on Sep 20, 2007 at 21:12 UTC
    Perl is here at the mercy of your system's timezone definitions. Probably those are b0rken.

    What system are you on?

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      I'm using Solaris 8 on Sun hardware.
        Thanks for your advice. I listed the contents of the /usr/share/lib/zoneinfo directory and found no subdirectory called Europe. I am therefore assuming that the system must default to a specified timezone if the given timezone is unrecognised.

        Thanks for your help.