]> Sergey Matveev's repositories - public-inbox.git/commitdiff
import: allow the epoch (0s) as a valid time
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Thu, 15 Feb 2018 23:20:20 +0000 (23:20 +0000)
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Thu, 15 Feb 2018 23:20:20 +0000 (23:20 +0000)
Despite email not existing until 1971; "Jan 1, 1970 00:00:00"
seems like a common default timestamp for some test emails
to use as a Date: header.

lib/PublicInbox/Import.pm

index f8d100377e17e6e3058b2a91e3b0795969b276ea..1f831a7bf118be2649ef21b0936affa01abc2fb9 100644 (file)
@@ -233,7 +233,7 @@ sub parse_date ($) {
                warn "bogus TZ offset: $zone, ignoring and assuming +0000\n";
                $zone = '+0000';
        }
-       $ts ||= time;
+       $ts = time unless defined $ts;
        $ts = 0 if $ts < 0; # git uses unsigned times
        "$ts $zone";
 }