{"thread":{"id":"38652","subject":"[PATCH] git-svn: fix localtime=true on non-glibc environments","startedAt":"2015-02-25T16:04:41Z","lastAt":"2015-02-25T19:42:13Z","messageCount":3,"participants":["Ryuichi Kokubo","Junio C Hamano","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"256642","messageId":"1424880281-570-1-git-send-email-ryu1kkb@gmail.com","threadId":"38652","inReplyTo":null,"subject":"[PATCH] git-svn: fix localtime=true on non-glibc environments","fromName":"Ryuichi Kokubo","fromEmail":"ryu1kkb@gmail.com","sentAt":"2015-02-25T16:04:41Z","receivedAt":"2015-02-25T16:04:41Z","isPatch":true,"sender":{"key":"ryu1kkb@gmail.com","avatar":null},"body":"git svn uses POSIX::strftime('%s', $sec, $min, ...) to make unix epoch time.\nBut lowercase %s formatting character is a GNU extention. This causes problem\nin git svn fetch --localtime on non-glibc systems, such as msys or cygwin.\nUsing Time::Local::timelocal($sec, $min, ...) fixes it.\n\nSigned-off-by: Ryuichi Kokubo <ryu1kkb@gmail.com>\n\nNotes:\n    lowercase %s format character in strftime is a GNU extension and not widely supported.\n    POSIX::strftime affected by underlying crt's strftime because POSIX::strftime just calls crt's one.\n    Time::Local is good function to replace POSIX::strftime because it's a perl core module function.\n    \n    Document about Time::Local.\n     http://perldoc.perl.org/Time/Local.html\n    \n    These are specifications of strftime.\n    \n    The GNU C Library Reference Manual.\n     http://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html\n    \n    perl POSIX module's strftime document. It does not have '%s'.\n     http://perldoc.perl.org/POSIX.html\n    \n    strftime document of Microsort Windows C Run-Time library.\n     https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx\n    \n    The Open Group's old specification does not have '%s' too.\n     http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html\n    \n    On my environment, following problems happened.\n    - msys   : git svn fetch does not progress at all with perl.exe consuming CPU.\n    - cygwin : git svn fetch progresses but time stamp information is dropped.\n       Every commits have unix epoch timestamp.\n    \n    I would like to thank git developer and contibutors.\n    git helps me so much everyday.\n    Thank you.\n---\n perl/Git/SVN.pm |    3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 8e4af71..f243726 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -14,6 +14,7 @@ use IPC::Open3;\n use Memoize;  # core since 5.8.0, Jul 2002\n use Memoize::Storable;\n use POSIX qw(:signal_h);\n+use Time::Local;\n \n use Git qw(\n     command\n@@ -1332,7 +1333,7 @@ sub parse_svn_date {\n \t\t$ENV{TZ} = 'UTC';\n \n \t\tmy $epoch_in_UTC =\n-\t\t    POSIX::strftime('%s', $S, $M, $H, $d, $m - 1, $Y - 1900);\n+\t\t    Time::Local::timelocal($S, $M, $H, $d, $m - 1, $Y - 1900);\n \n \t\t# Determine our local timezone (including DST) at the\n \t\t# time of $epoch_in_UTC.  $Git::SVN::Log::TZ stored the\n-- \n1.7.10.4\n"},{"id":"256647","messageId":"xmqqfv9tomzx.fsf@gitster.dls.corp.google.com","threadId":"38652","inReplyTo":"1424880281-570-1-git-send-email-ryu1kkb@gmail.com","subject":"Re: [PATCH] git-svn: fix localtime=true on non-glibc environments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-02-25T18:38:10Z","receivedAt":"2015-02-25T18:38:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ryuichi Kokubo <ryu1kkb@gmail.com> writes:\n\n> git svn uses POSIX::strftime('%s', $sec, $min, ...) to make unix epoch time.\n> But lowercase %s formatting character is a GNU extention. This causes problem\n> in git svn fetch --localtime on non-glibc systems, such as msys or cygwin.\n> Using Time::Local::timelocal($sec, $min, ...) fixes it.\n>\n> Signed-off-by: Ryuichi Kokubo <ryu1kkb@gmail.com>\n\nSounds sensible.\n\nBecause we already have \"use Time::Local qw(...)\" in perl/Git.pm\nthat is used by git-svn, we know the platforms that are capable\nof running the current git-svn do have Time::Local available, so\nI do not have worries about new dependency, either.\n\nEric?\n\n>\n> Notes:\n>     lowercase %s format character in strftime is a GNU extension and not widely supported.\n>     POSIX::strftime affected by underlying crt's strftime because POSIX::strftime just calls crt's one.\n>     Time::Local is good function to replace POSIX::strftime because it's a perl core module function.\n>     \n>     Document about Time::Local.\n>      http://perldoc.perl.org/Time/Local.html\n>     \n>     These are specifications of strftime.\n>     \n>     The GNU C Library Reference Manual.\n>      http://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html\n>     \n>     perl POSIX module's strftime document. It does not have '%s'.\n>      http://perldoc.perl.org/POSIX.html\n>     \n>     strftime document of Microsort Windows C Run-Time library.\n>      https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx\n>     \n>     The Open Group's old specification does not have '%s' too.\n>      http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html\n>     \n>     On my environment, following problems happened.\n>     - msys   : git svn fetch does not progress at all with perl.exe consuming CPU.\n>     - cygwin : git svn fetch progresses but time stamp information is dropped.\n>        Every commits have unix epoch timestamp.\n>     \n>     I would like to thank git developer and contibutors.\n>     git helps me so much everyday.\n>     Thank you.\n> ---\n>  perl/Git/SVN.pm |    3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n>\n> diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\n> index 8e4af71..f243726 100644\n> --- a/perl/Git/SVN.pm\n> +++ b/perl/Git/SVN.pm\n> @@ -14,6 +14,7 @@ use IPC::Open3;\n>  use Memoize;  # core since 5.8.0, Jul 2002\n>  use Memoize::Storable;\n>  use POSIX qw(:signal_h);\n> +use Time::Local;\n>  \n>  use Git qw(\n>      command\n> @@ -1332,7 +1333,7 @@ sub parse_svn_date {\n>  \t\t$ENV{TZ} = 'UTC';\n>  \n>  \t\tmy $epoch_in_UTC =\n> -\t\t    POSIX::strftime('%s', $S, $M, $H, $d, $m - 1, $Y - 1900);\n> +\t\t    Time::Local::timelocal($S, $M, $H, $d, $m - 1, $Y - 1900);\n>  \n>  \t\t# Determine our local timezone (including DST) at the\n>  \t\t# time of $epoch_in_UTC.  $Git::SVN::Log::TZ stored the\n"},{"id":"256653","messageId":"20150225194213.GA32026@dcvr.yhbt.net","threadId":"38652","inReplyTo":"xmqqfv9tomzx.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] git-svn: fix localtime=true on non-glibc environments","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2015-02-25T19:42:13Z","receivedAt":"2015-02-25T19:42:13Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Ryuichi Kokubo <ryu1kkb@gmail.com> writes:\n> \n> > git svn uses POSIX::strftime('%s', $sec, $min, ...) to make unix epoch time.\n> > But lowercase %s formatting character is a GNU extention. This causes problem\n> > in git svn fetch --localtime on non-glibc systems, such as msys or cygwin.\n> > Using Time::Local::timelocal($sec, $min, ...) fixes it.\n> >\n> > Signed-off-by: Ryuichi Kokubo <ryu1kkb@gmail.com>\n> \n> Sounds sensible.\n> \n> Because we already have \"use Time::Local qw(...)\" in perl/Git.pm\n> that is used by git-svn, we know the platforms that are capable\n> of running the current git-svn do have Time::Local available, so\n> I do not have worries about new dependency, either.\n> \n> Eric?\n\nLooks good, thanks.  Signed-off and queued up.\n"}]}