1. Stefan Saasen
  2. git

Commits

Junio C Hamano  committed 48b6026 Merge

Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
git-svn fix to avoid using strftime %z

  • Participants
  • Parent commits 3ca9364, e871784
  • Branches master

Comments (0)

Files changed (1)

File git-svn.perl

View file
  • Ignore whitespace
 use strict;
 use warnings;
 use POSIX qw/strftime/;
+use Time::Local;
 use constant commit_log_separator => ('-' x 72) . "\n";
 use vars qw/$TZ $limit $color $pager $non_recursive $verbose $oneline
             %rusers $show_commit $incremental/;
 }
 
 sub format_svn_date {
-	return strftime("%Y-%m-%d %H:%M:%S %z (%a, %d %b %Y)", localtime(shift));
+	# some systmes don't handle or mishandle %z, so be creative.
+	my $t = shift;
+	my $gm = timelocal(gmtime($t));
+	my $sign = qw( + + - )[ $t <=> $gm ];
+	my $gmoff = sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]);
+	return strftime("%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y)", localtime($t));
 }
 
 sub parse_git_date {