Permalink
Browse files

Bug fix: $tzoffset calculation

Fix for time zones, that are not on full hour offsets.
  • Loading branch information...
augensalat committed Oct 17, 2012
1 parent 63882c6 commit 4757f9471e2d5e367167419f001786a97b01f72f
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/Plack/Middleware/AccessLog.pm
@@ -13,12 +13,12 @@ my %formats = (
);
use POSIX ();
use Time::Local ();
my $tzoffset = POSIX::strftime("%z", localtime) !~ /^[+-]\d{4}$/ && do {
my @t = localtime(time);
my $s = Time::Local::timegm(@t) - Time::Local::timelocal(@t);
sprintf '%+03d%02u', int($s/3600), $s % 3600;
require Time::Local;
my @t = localtime;
my $s = int(Time::Local::timegm(@t) - Time::Local::timelocal(@t)) / 60;
sprintf '%+03d%02u', $s / 60, $s % 60;
};
sub call {

0 comments on commit 4757f94

Please sign in to comment.