path: root/perl
diff options
authorRyuichi Kokubo <>2015-02-25 16:04:41 (GMT)
committerJunio C Hamano <>2015-02-26 22:02:34 (GMT)
commit45c956b35731fcbda4cf29fcd1658d9418bec2d1 (patch)
tree95bc676bdde07ec7883abb7ee75fc4e73e770498 /perl
parentfdf96a20acf96a6ac538df8113b2aafd6ed71d50 (diff)
git-svn: fix localtime=true on non-glibc environments
git svn uses POSIX::strftime('%s', $sec, $min, ...) to make unix epoch time. But lowercase %s formatting character is a GNU extention. This causes problem in git svn fetch --localtime on non-glibc systems, such as msys or cygwin. Using Time::Local::timelocal($sec, $min, ...) fixes it. Signed-off-by: Ryuichi Kokubo <> Signed-off-by: Eric Wong <> Notes: lowercase %s format character in strftime is a GNU extension and not widely supported. POSIX::strftime affected by underlying crt's strftime because POSIX::strftime just calls crt's one. Time::Local is good function to replace POSIX::strftime because it's a perl core module function. Document about Time::Local. These are specifications of strftime. The GNU C Library Reference Manual. perl POSIX module's strftime document. It does not have '%s'. strftime document of Microsort Windows C Run-Time library. The Open Group's old specification does not have '%s' too. On my environment, following problems happened. - msys : git svn fetch does not progress at all with perl.exe consuming CPU. - cygwin : git svn fetch progresses but time stamp information is dropped. Every commits have unix epoch timestamp. I would like to thank git developer and contibutors. git helps me so much everyday. Thank you. Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'perl')
1 files changed, 2 insertions, 1 deletions
diff --git a/perl/Git/ b/perl/Git/
index d9a52a5..7006219 100644
--- a/perl/Git/
+++ b/perl/Git/
@@ -14,6 +14,7 @@ use IPC::Open3;
use Memoize; # core since 5.8.0, Jul 2002
use Memoize::Storable;
use POSIX qw(:signal_h);
+use Time::Local;
use Git qw(
@@ -1332,7 +1333,7 @@ sub parse_svn_date {
$ENV{TZ} = 'UTC';
my $epoch_in_UTC =
- POSIX::strftime('%s', $S, $M, $H, $d, $m - 1, $Y - 1900);
+ Time::Local::timelocal($S, $M, $H, $d, $m - 1, $Y - 1900);
# Determine our local timezone (including DST) at the
# time of $epoch_in_UTC. $Git::SVN::Log::TZ stored the