]> Sergey Matveev's repositories - public-inbox.git/commit
nntp: handle 2-digit year "70" properly
authorEric Wong <e@80x24.org>
Wed, 1 Jan 2020 03:28:22 +0000 (03:28 +0000)
committerEric Wong <e@80x24.org>
Wed, 1 Jan 2020 03:49:32 +0000 (03:49 +0000)
commit57c2bb80e2f94dfcbf08532f72c7ed568ceef7be
treee692347dba58a27b23c0d8f64ad80e51f46e3a75
parent39f2513042482162c8bb855c67b3806786e3516e
nntp: handle 2-digit year "70" properly

Time::Local has the concept of a "rolling century" which is
defined at 50 years on either side of the current year.  Since
it's now 2020 and >50 years since the Unix epoch, the year "70"
gets interpreted by Time::Local as 2070-01-01 instead of
1970-01-01.

Since NNTP servers are unlikely to store messages from the
future, we'll feed 4-digit year to Time::Local::{timegm,timelocal}
and hopefully not have to worry about things until Y10K.

This fixes test failures on t/v2writable.t and t/nntpd.t since
2020-01-01.
lib/PublicInbox/NNTP.pm
t/nntp.t