@matheusbsbs / matheus-bagliano / commits / e871784132
Fork 0

git-svn fix to avoid using strftime %z

%z isn't available on all platforms in the date formatting routines. Provide a workalike capability that should be more portable. Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca> Acked-by: Eric Wong <normalperson@yhbt.net>

Ben Walton committed Feb 24, 2009 at 14:44 UTC e871784132038a500f3390859da3bbe95b9a0fc2
1 file changed +7 -1
git-svn.perl
+7 -1
@@ -4630,6 +4630,7 @@ package Git::SVN::Log;
4630 use strict;
4631 use warnings;
4632 use POSIX qw/strftime/;
4633 +use Time::Local;
4634 use constant commit_log_separator => ('-' x 72) . "\n";
4635 use vars qw/$TZ $limit $color $pager $non_recursive $verbose $oneline
4636 %rusers $show_commit $incremental/;
@@ -4736,7 +4737,12 @@ sub run_pager {
4737 }
4738
4739 sub format_svn_date {
4739 - return strftime("%Y-%m-%d %H:%M:%S %z (%a, %d %b %Y)", localtime(shift));
4740 + # some systmes don't handle or mishandle %z, so be creative.
4741 + my $t = shift;
4742 + my $gm = timelocal(gmtime($t));
4743 + my $sign = qw( + + - )[ $t <=> $gm ];
4744 + my $gmoff = sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]);
4745 + return strftime("%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y)", localtime($t));
4746 }
4747
4748 sub parse_git_date {