diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-02-25 08:04:03 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-02-25 08:04:03 -0800 |
commit | 8552e2e5905b56db9a61da94f9eaf376a6e57b89 (patch) | |
tree | 72339491fb623b522de2ac222ceb3ff13f71cc06 /perl/Git | |
parent | Merge branch 'al/mergetool-printf-fix' into maint (diff) | |
parent | cvsimport: format commit timestamp ourselves without using strftime (diff) | |
download | tgif-8552e2e5905b56db9a61da94f9eaf376a6e57b89.tar.xz |
Merge branch 'bw/get-tz-offset-perl' into maint
* bw/get-tz-offset-perl:
cvsimport: format commit timestamp ourselves without using strftime
perl/Git.pm: fix get_tz_offset to properly handle DST boundary cases
Move Git::SVN::get_tz to Git::get_tz_offset
Diffstat (limited to 'perl/Git')
-rw-r--r-- | perl/Git/SVN.pm | 12 | ||||
-rw-r--r-- | perl/Git/SVN/Log.pm | 8 |
2 files changed, 8 insertions, 12 deletions
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm index 59215fa86e..8c84560a49 100644 --- a/perl/Git/SVN.pm +++ b/perl/Git/SVN.pm @@ -11,7 +11,6 @@ use Carp qw/croak/; use File::Path qw/mkpath/; use File::Copy qw/copy/; use IPC::Open3; -use Time::Local; use Memoize; # core since 5.8.0, Jul 2002 use Memoize::Storable; use POSIX qw(:signal_h); @@ -22,6 +21,7 @@ use Git qw( command_noisy command_output_pipe command_close_pipe + get_tz_offset ); use Git::SVN::Utils qw( fatal @@ -1311,14 +1311,6 @@ sub get_untracked { \@out; } -sub get_tz { - # some systmes don't handle or mishandle %z, so be creative. - my $t = shift || time; - my $gm = timelocal(gmtime($t)); - my $sign = qw( + + - )[ $t <=> $gm ]; - return sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]); -} - # parse_svn_date(DATE) # -------------------- # Given a date (in UTC) from Subversion, return a string in the format @@ -1351,7 +1343,7 @@ sub parse_svn_date { delete $ENV{TZ}; } - my $our_TZ = get_tz(); + my $our_TZ = get_tz_offset(); # This converts $epoch_in_UTC into our local timezone. my ($sec, $min, $hour, $mday, $mon, $year, diff --git a/perl/Git/SVN/Log.pm b/perl/Git/SVN/Log.pm index 3cc1c6f081..3f8350a57d 100644 --- a/perl/Git/SVN/Log.pm +++ b/perl/Git/SVN/Log.pm @@ -2,7 +2,11 @@ package Git::SVN::Log; use strict; use warnings; use Git::SVN::Utils qw(fatal); -use Git qw(command command_oneline command_output_pipe command_close_pipe); +use Git qw(command + command_oneline + command_output_pipe + command_close_pipe + get_tz_offset); use POSIX qw/strftime/; use constant commit_log_separator => ('-' x 72) . "\n"; use vars qw/$TZ $limit $color $pager $non_recursive $verbose $oneline @@ -119,7 +123,7 @@ sub run_pager { sub format_svn_date { my $t = shift || time; require Git::SVN; - my $gmoff = Git::SVN::get_tz($t); + my $gmoff = get_tz_offset($t); return strftime("%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y)", localtime($t)); } |