Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Possible bug in BulkMail.pm?

Quote Reply
Possible bug in BulkMail.pm?
My site is hosted on a server that is located in a timezone +9.30 from GMT (+10.30 in summer). I have the server date offset set to zero.

I have been working on a newsletter mailing and the time on the emails is 30 minutes out i.e. the time says 8.42 am when it should be 8.12 am. I have had a look at the mail headers and I think the problem arises from an incorrect time zone calculation.

The code below is from BulkMail.pm, and I suspect it rounds off to whole hours and ignores the time zones that use half hour intervals. If anyone can shed some light on this it would be appreciated ;).

Code:
# Returns an RFC822 compliant date.
sub RFC822_date (;$$) {
require GT::Date;
GT::Date->import(':timelocal');
shift if ref $_[0];
my $time = @_ ? shift : time;
my @lt = localtime($time);
my @ut = gmtime($time);
use integer;
my $tzs = (timegm(@lt) - timelocal(@lt));
my $tzh = $tzs / 3600;
my $tzm = $tzs % 60 / 60;
my $tz = 100*$tzh + 60*$tzm;
no integer;
sprintf(
"%s, %02d %s %04d %02d:%02d:%02d %+05d",
(qw/Sun Mon Tue Wed Thu Fri Sat/)[$lt[6]],
$lt[3],
(qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/)[$lt[4]],
$lt[5] + 1900,
@lt[2,1,0],
$tz
);
}

Last edited by:

aus_dave: Dec 5, 2005, 2:03 PM
Quote Reply
Re: [aus_dave] Possible bug in BulkMail.pm? In reply to
When I replace 'my $tz = 100*$tzh + 60*$tzm;' with 'my $tz = 1030;' the timezone and the time on the email is correct.

It looks like there is an error in the code.
Quote Reply
Re: [aus_dave] Possible bug in BulkMail.pm? In reply to
Can someone from GT please comment on this?

It might not seem like a major problem but for those of us with servers in time zones using half hour increments it is.
Quote Reply
Re: [aus_dave] Possible bug in BulkMail.pm? In reply to
This bug still exists - my changes to the code were replaced by a recent version upgrade and the timezone calculation is still incorrect.