about summary refs log tree commit homepage
path: root/lib/PublicInbox/MsgTime.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-01 22:04:25 +0000
committerEric Wong <e@80x24.org>2019-12-12 03:51:45 +0000
commit74fd81670fcc9eaec15a009995e52f9aeefa1494 (patch)
treeb26e473c8ec8b91181a6d8677183234edb1c2f72 /lib/PublicInbox/MsgTime.pm
parent56643bfddba2f7bca60955e5c48435fe58cc8e1c (diff)
downloadpublic-inbox-74fd81670fcc9eaec15a009995e52f9aeefa1494.tar.gz
Wacky dates show up in lore for valid messages.  Lets ignore
them and let future generations deal with Y10K and time-travel
problems.
Diffstat (limited to 'lib/PublicInbox/MsgTime.pm')
-rw-r--r--lib/PublicInbox/MsgTime.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/PublicInbox/MsgTime.pm b/lib/PublicInbox/MsgTime.pm
index 479aaa4e..9f432644 100644
--- a/lib/PublicInbox/MsgTime.pm
+++ b/lib/PublicInbox/MsgTime.pm
@@ -38,7 +38,7 @@ sub str2date_zone ($) {
         if ($date =~ /(?:[A-Za-z]+,?\s+)? # day-of-week
                         ([0-9]+),?\s+  # dd
                         ([A-Za-z]+)\s+ # mon
-                        ([0-9]{2,})\s+ # YYYY or YY (or YYY :P)
+                        ([0-9]{2,4})\s+ # YYYY or YY (or YYY :P)
                         ([0-9]+)[:\.] # HH:
                                 ((?:[0-9]{2})|(?:\s?[0-9])) # MM
                                 (?:[:\.]((?:[0-9]{2})|(?:\s?[0-9])))? # :SS
@@ -67,6 +67,10 @@ sub str2date_zone ($) {
 
                 $ts = timegm($ss // 0, $mm, $hh, $dd, $mon, $yyyy);
 
+                # 4-digit dates in non-spam from 1900s and 1910s exist in
+                # lore archives
+                return if $ts < 0;
+
                 # Compute the time offset from [+-]HHMM
                 $tz //= 0;
                 my ($tz_hh, $tz_mm);