Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mail-Sender CPAN distribution.

Report information
The Basics
Id: 34027
Status: resolved
Priority: 0/
Queue: Mail-Sender

People
Owner: JENDA [...] cpan.org
Requestors: ncastellano [...] alliancebernstein.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: DST offset bug
Date: Wed, 12 Mar 2008 11:20:39 -0400
To: <bug-Mail-Sender [...] rt.cpan.org>
From: "Castellano, Nicholas" <ncastellano [...] alliancebernstein.com>
Hi, If a long-running script starts before a Daylight Saving Time transition, it will generate message timestamps with an incorrect DST offset after the transition. The problem occurs because the offset is only computed once and then reused. The problem is easily fixed by moving the computation to a subroutine, and calling that subroutine each time the offset is needed. Distribution name and version: Mail-Sender-0.8.13 Perl version: This is perl, v5.8.5 built for i386-linux-thread-multi Operating System vendor and version: Linux amarld16 2.6.9-42.0.8.ELsmp #1 SMP Tue Jan 23 13:01:26 EST 2007 i686 athlon i386 GNU/Linux Patch: --- Sender.pm.orig 2006-02-25 13:26:54.000000000 -0500 +++ Sender.pm 2008-03-12 11:02:50.000000000 -0400 @@ -67,8 +67,9 @@ my $local_IP = join('.',unpack('CCCC',(gethostbyname $local_name)[4])); #time diference to GMT - Windows will not set $ENV{'TZ'}, if you know a better way ... -my $GMTdiff; +sub GMTdiff { + my $GMTdiff; my $time = time(); my @local = (localtime($time))[2,1,3,4,5]; # hour, minute, mday, month, year; I don't mind year is 1900 based and month 0-11 my @gm = (gmtime($time))[2,1,3,4,5]; @@ -101,6 +102,7 @@ } } $GMTdiff = (($hourdiff < 0 || $mindiff < 0) ? '-' : '+') . sprintf "%02d%02d", abs($hourdiff), abs($mindiff); + return $GMTdiff; } ## you could also use this code by "John W. Krahn" <krahnj@acm.org> # use Time::Local @@ -1210,7 +1212,7 @@ unless (defined $Mail::Sender::NO_DATE and $Mail::Sender::NO_DATE) { my $date = localtime(); $date =~ s/^(\w+)\s+(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+(\d+)$/$1, $3 $2 $5 $4/; - print_hdr $s, "Date" => "$date $GMTdiff"; + print_hdr $s, "Date" => ("$date " . &GMTdiff()); } if ($self->{'priority'}) { @@ -1429,7 +1431,7 @@ unless (defined $Mail::Sender::NO_DATE and $Mail::Sender::NO_DATE) { my $date = localtime(); $date =~ s/^(\w+)\s+(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+(\d+)$/$1, $3 $2 $5 $4/; - print_hdr $s, "Date" => "$date $GMTdiff" ; + print_hdr $s, "Date" => ("$date " . &GMTdiff()); } if ($self->{'priority'}) { Thanks! -- Nicholas S. Castellano Assistant Vice President AllianceBernstein L.P. Global Enterprise Technology Services ----------------------------------------- The information contained in this transmission may be privileged and confidential and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions. If you, as the intended recipient of this message, the purpose of which is to inform and update our clients, prospects and consultants of developments relating to our services and products, would not like to receive further e-mail correspondence from the sender, please "reply" to the sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New York, NY 10105.
From: JENDA [...] cpan.org
On Wed Mar 12 11:44:41 2008, ncastellano@alliancebernstein.com wrote: Show quoted text
> Hi, > > If a long-running script starts before a Daylight Saving Time > transition, it will generate message timestamps with an incorrect DST > offset after the transition. The problem occurs because the offset is > only computed once and then reused. The problem is easily fixed by > moving the computation to a subroutine, and calling that subroutine > each > time the offset is needed.
This is already fixed in the not-yet-released version. The DST computation is in subroutine/method ResetGMTdiff which may be called as often as you like :-) I have to sum up the changes, retest them and release the module. Jenda
in 0.8.16