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 ;).
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
);
}
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
);
}