path: root/perl/Git/
diff options
authorBernhard M. Wiedemann <>2018-02-23 17:20:45 (GMT)
committerJunio C Hamano <>2018-02-23 22:47:06 (GMT)
commita40e06ee336d608cfe0928d91d2b44112d8fd1e2 (patch)
tree4256cb0c84d3294290f188b37496c9583a9cdc7b /perl/Git/
parentffa952497288d29d94b16675c6789ef83850def3 (diff)
perl: call timegm and timelocal with 4-digit year
Amazingly, timegm(gmtime(0)) is only 0 before 2020 because perl's timegm deviates from GNU timegm(3) in how it handles years. man Time::Local says Whenever possible, use an absolute four digit year instead. with a detailed explanation about ambiguity of 2-digit years above that. Even though this ambiguity is error-prone with >50% of users getting it wrong, it has been like this for 20+ years, so we just use 4-digit years everywhere to be on the safe side. We add some extra logic to cvsimport because it allows 2-digit year input and interpreting an 18 as 1918 can be avoided easily and safely. Signed-off-by: Bernhard M. Wiedemann <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'perl/Git/')
1 files changed, 1 insertions, 1 deletions
diff --git a/perl/Git/ b/perl/Git/
index bc4eed3..991a588 100644
--- a/perl/Git/
+++ b/perl/Git/
@@ -1405,7 +1405,7 @@ sub parse_svn_date {
$ENV{TZ} = 'UTC';
my $epoch_in_UTC =
- Time::Local::timelocal($S, $M, $H, $d, $m - 1, $Y - 1900);
+ Time::Local::timelocal($S, $M, $H, $d, $m - 1, $Y);
# Determine our local timezone (including DST) at the
# time of $epoch_in_UTC. $Git::SVN::Log::TZ stored the