diff options
author | Ben Walton <bdwalton@gmail.com> | 2013-02-09 21:46:58 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-02-09 14:41:49 -0800 |
commit | 48c916285753907b71a0ef663576f01ee260095c (patch) | |
tree | 13afab98d01b48c04eb17503fb6d9f3d45890bed | |
parent | 75f7b5dfc47a9c764207559934b1c550423a243a (diff) | |
download | git-48c916285753907b71a0ef663576f01ee260095c.tar.gz |
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>
-rwxr-xr-x | git-cvsimport.perl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 0a31ebd820..344f1206d1 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -26,6 +26,7 @@ use IO::Socket; use IO::Pipe; use POSIX qw(strftime tzset dup2 ENOENT); use IPC::Open2; +use Git qw(get_tz_offset); $SIG{'PIPE'}="IGNORE"; set_timezone('UTC'); @@ -864,7 +865,9 @@ sub commit { } set_timezone($author_tz); - my $commit_date = strftime("%s %z", localtime($date)); + # $date is in the seconds since epoch format + my $tz_offset = get_tz_offset($date); + my $commit_date = "$date $tz_offset"; set_timezone('UTC'); $ENV{GIT_AUTHOR_NAME} = $author_name; $ENV{GIT_AUTHOR_EMAIL} = $author_email; |