]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Fix parsing of negative fractional timezones in JavaScript
[Gitweb] / gitweb.perl
index a559dc831476c9a334855cc1b6ee5f92581d146fdb281023ff655fe686cc53f4..1c2bd12ca57e9320d27e463c5c69c7e2d7157e4f68368adaa6ea3f42a8ba4bf5 100755 (executable)
@@ -2922,8 +2922,10 @@ sub parse_date {
        $date{'iso-8601'}  = sprintf "%04d-%02d-%02dT%02d:%02d:%02dZ",
                             1900+$year, 1+$mon, $mday, $hour ,$min, $sec;
 
-       $tz =~ m/^([+\-][0-9][0-9])([0-9][0-9])$/;
-       my $local = $epoch + ((int $1 + ($2/60)) * 3600);
+       my ($tz_sign, $tz_hour, $tz_min) =
+               ($tz =~ m/^([-+])(\d\d)(\d\d)$/);
+       $tz_sign = ($tz_sign eq '-' ? -1 : +1);
+       my $local = $epoch + $tz_sign*((($tz_hour*60) + $tz_min)*60);
        ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($local);
        $date{'hour_local'} = $hour;
        $date{'minute_local'} = $min;
This page took 0.135929 seconds and 4 git commands to generate.