Subject: | TimeDate 1.20 tz2zone("America/Chicago") doesn't work |
Date: | Thu, 3 May 2012 12:30:11 -0500 |
To: | bug-TimeDate [...] rt.cpan.org |
From: | Cary Millsap <cary.millsap [...] method-r.com> |
Graham,
Using Time::Zone in TimeDate v1.20, I've found that tz2zone() doesn't
convert time zones of the form "America/Chicago" to a value usable by
tz_offset. My OS (Mac OS X, Linux, Solaris) does consider TZ values of the
form "America/Chicago" to be valid:
$ zdump "America/Chicago"
America/Chicago Thu May 3 12:23:16 2012 CDT
Here is a test in Perl that illustrates the problem:
$ more t.pl
use strict;
use warnings;
use Time::Zone;
$ENV{TZ} = "-0500";
printf "%20s %20s %20s\n", qw(input tz2zone tzoffset(tz2zone));
printf "%20s %20s %20s\n", '-'x20, '-'x20, '-'x20;
for (qw(-0500 CST6CDT America/Chicago)) {
printf "%20s %20s %20s\n", $_, tz2zone($_),
tz_offset(tz2zone($_))//"undef";
}
$ perl t.pl
input tz2zone tzoffset(tz2zone)
-------------------- -------------------- --------------------
-0500 -0500 -18000
CST6CDT CST -21600
America/Chicago America/Chicago undef
Thank you for looking into it.
Cary Millsap