cvsimport: format commit timestamp ourselves without using strftime

Some implementations of strftime(3) lack support for "%z". Also there is no need for %s in git-cvsimport as the supplied time is already in seconds since the epoch. For %z, use the function get_tz_offset provided by Git.pm instead. Signed-off-by: Ben Walton <bdwalton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ben Walton committed Feb 9, 2013 at 21:46 UTC 48c916285753907b71a0ef663576f01ee260095c
1 file changed +4 -1
git-cvsimport.perl
+4 -1
@@ -26,6 +26,7 @@ use IO::Socket;
26 use IO::Pipe;
27 use POSIX qw(strftime tzset dup2 ENOENT);
28 use IPC::Open2;
29 +use Git qw(get_tz_offset);
30
31 $SIG{'PIPE'}="IGNORE";
32 set_timezone('UTC');
@@ -864,7 +865,9 @@ sub commit {
865 }
866
867 set_timezone($author_tz);
867 - my $commit_date = strftime("%s %z", localtime($date));
868 + # $date is in the seconds since epoch format
869 + my $tz_offset = get_tz_offset($date);
870 + my $commit_date = "$date $tz_offset";
871 set_timezone('UTC');
872 $ENV{GIT_AUTHOR_NAME} = $author_name;
873 $ENV{GIT_AUTHOR_EMAIL} = $author_email;