summaryrefslogtreecommitdiff
path: root/perl/Git.pm
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-06 22:54:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-06 22:54:08 (GMT)
commit179e1f53b8a8ce4ea756e644fc1da0006d8f0c25 (patch)
tree997bfbc5ad35898edcdc42464c2245f992678e7c /perl/Git.pm
parent6c3e6f6fcbdd12c70a849e4e1be57d82edb8f14f (diff)
parenta40e06ee336d608cfe0928d91d2b44112d8fd1e2 (diff)
downloadgit-179e1f53b8a8ce4ea756e644fc1da0006d8f0c25.zip
git-179e1f53b8a8ce4ea756e644fc1da0006d8f0c25.tar.gz
git-179e1f53b8a8ce4ea756e644fc1da0006d8f0c25.tar.bz2
Merge branch 'bw/perl-timegm-timelocal-fix'
Y2k20 fix ;-) for our perl scripts. * bw/perl-timegm-timelocal-fix: perl: call timegm and timelocal with 4-digit year
Diffstat (limited to 'perl/Git.pm')
-rw-r--r--perl/Git.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/perl/Git.pm b/perl/Git.pm
index 9d60d79..a7440a1 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -534,7 +534,9 @@ If TIME is not supplied, the current local time is used.
sub get_tz_offset {
# some systems don't handle or mishandle %z, so be creative.
my $t = shift || time;
- my $gm = timegm(localtime($t));
+ my @t = localtime($t);
+ $t[5] += 1900;
+ my $gm = timegm(@t);
my $sign = qw( + + - )[ $gm <=> $t ];
return sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]);
}