git-blame: Use the same tests for git-blame as for git-annotate
[git.git] / git-annotate.perl
index 08d479f..b113def 100755 (executable)
@@ -128,7 +128,7 @@ foreach my $l (@filelines) {
        }
 
        printf("%s\t(%10s\t%10s\t%d)%s\n", $rev, $committer,
-               format_date($date), $i++, $output);
+               format_date($date), ++$i, $output);
 }
 
 sub init_claim {
@@ -418,7 +418,13 @@ sub format_date {
                return $_[0];
        }
        my ($timestamp, $timezone) = split(' ', $_[0]);
-       return strftime("%Y-%m-%d %H:%M:%S " . $timezone, gmtime($timestamp));
+       my $minutes = abs($timezone);
+       $minutes = int($minutes / 100) * 60 + ($minutes % 100);
+       if ($timezone < 0) {
+           $minutes = -$minutes;
+       }
+       my $t = $timestamp + $minutes * 60;
+       return strftime("%Y-%m-%d %H:%M:%S " . $timezone, gmtime($t));
 }
 
 # Copied from git-send-email.perl - We need a Git.pm module..