cvsps formats timestamps for the local timezone in its output.
Using timegm() to convert to epoch-relative only works because
cvsimport overrides TZ to "UTC".  Using timelocal() does not change
the behavior of the script as is, but it does ensure cvsimport
behaves sanely if run with another TZ value.

Also, use localtime() for generating the commit timestamp instead of
gmtime().  Again, this has no affect on the script as is since TZ
is hard-wired to "UTC".  But using localtime() would allow someone
to change the value of TZ with what is likely the desired effect
(i.e., timestamps are written to the Git commit with local timezone

Signed-off-by: Chris Rorvick <>
 git-cvsimport.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 8032f23..2f5da9e 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -582,7 +582,7 @@ sub pdate($) {
                or die "Unparseable date: $d\n";
        my $y=$1; $y-=1900 if $y>1900;
-       return timegm($6||0,$5,$4,$3,$2-1,$y);
+       return timelocal($6||0,$5,$4,$3,$2-1,$y);
 sub pmode($) {
@@ -844,7 +844,7 @@ sub commit {
-       my $commit_date = strftime("+0000 %Y-%m-%d %H:%M:%S",gmtime($date));
+       my $commit_date = strftime("%z %Y-%m-%d %H:%M:%S",localtime($date));
        $ENV{GIT_AUTHOR_NAME} = $author_name;
        $ENV{GIT_AUTHOR_EMAIL} = $author_email;
        $ENV{GIT_AUTHOR_DATE} = $commit_date;

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to