Date: | Mon, 08 Jul 2002 21:04:17 -0500 |
From: | "Douglas K. Rand" <rand [...] meridian-enviro.com> |
To: | gbarr [...] pobox.com |
Subject: | Time::Zone |
First off, your Date::Format and Date::Parse modules get alot of use
around here.
We often use your packages to give is time strings in other time
zones. We are in "CST6CDT" but we have customers all over the place,
and those in places that don't switch to day light savings time cause
us difficulities.
We are having a small difficulity with tz2zone in Time::Zone, which it
doesn't look like you wrote. :) If the time zone is sepecified as,
say, "EST5" tz2zone returns undef if localtime says that day light
savings time is in effect. The problem is that the code expected $4 to
have a value, when that value is optional. The problem is in:
if ($TZ =~ /^
( [^:\d+\-,] {3,} )
( [+-] ?
\d {1,2}
( : \d {1,2} ) {0,2}
)
( [^\d+\-,] {3,} )?
/x
) {
$TZ = $isdst ? $4 : $1;
$tzn_cache{$TZ} = [ $1, $4 ];
} else {
$tzn_cache{$TZ} = [ $TZ, $TZ ];
}
I think that something like this would solve the problem:
if ($TZ =~ /^
( [^:\d+\-,] {3,} )
( [+-] ?
\d {1,2}
( : \d {1,2} ) {0,2}
)
( [^\d+\-,] {3,} )?
/x
) {
$TZ = $isdst ? (defined($4) ? $4 : $1) : $1;
$tzn_cache{$TZ} = [ $1, (defined($4) ? $4 : $1) ];
} else {
$tzn_cache{$TZ} = [ $TZ, $TZ ];
}