Subject: | EasyMail 2.4.4 timezone bug |
Date: | Wed, 12 Mar 2008 10:48:53 -0700 |
To: | <bug-EasyMail [...] rt.cpan.org> |
From: | "Ursetti, Jerry" <Jerry.Ursetti [...] wellpoint.com> |
Distribution name: EasyMail 2.4.4
Perl version: 5.8.8
OS: AIX 5.3 ML7
I discovered a problem with the time in email headers this week - it was
advanced 1 hour. For example, an email sent at 10AM would display 11AM
in the email header. This problem started Sunday, March 9, 2008, after
daylight savings time started.
I traced the process and found a bug in the way EasyMail calculates the
timezone.
The gen_date function contains this code (line 316):
my $tz=int
((Time::Local::timegm(0,0,0,1,0,2000)-Time::Local::timelocal(0,0,0,1,0,2
000))/3600);
In the Pacific timezone, this returns -8. Because the time and date are
hardcoded as 00:00:00 January 1, 2000, it doesn't know we're now in
daylight savings time.
The following code uses the current time and returns the correct
timezone: -7.
my @now = localtime(time);
my $sec = $now[0];
my $min = $now[1];
my $hr = $now[2];
my $day = $now[3];
my $mon = $now[4];
my $yr = $now[5] + 1900;
my $gm = Time::Local::timegm($sec,$min,$hr,$day,$mon,$yr);
my $local = Time::Local::timelocal($sec,$min,$hr,$day,$mon,$yr);
my $tz = int (($gm-$local)/3600);
Jerry Ursetti
__ _ ___
/_ / | (_ /\/\
/ /__/___) / \
Financial Data & Systems Management
(805)557-4212 (Work)
(805)732-8484 (Blackberry)
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information or otherwise protected by law. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.