Re: [PATCH] Call timegm and timelocal with 4-digit year
- From
- Bernhard M. Wiedemann <bwiedemann@suse.de>
- Date
- Feb 26, 2018, 10:59 UTC
- Message-ID
- <81704602-1c81-f46c-f306-968147327e74@suse.de>
- In-Reply-To
- <87tvu6dntx.fsf@evledraar.gmail.com>
On 2018-02-24 23:28, Ævar Arnfjörð Bjarmason wrote:
> My Time::Local 1.2300 on perl 5.024001 currently interprets "69" here as > 1969, but after this it'll be 2069.
on one hand, there is already perl -e 'use Time::Local; print scalar gmtime(Time::Local::timegm(0,0,0,1,0,68))' Sun Jan 1 00:00:00 2068
The problem here is the 'currently', because in 11 months from now, 69 will be interpreted as 2069 by Time::Local, too.
faketime 2019-01-01 perl -e 'use Time::Local; print scalar gmtime(Time::Local::timegm(0,0,0,1,0,69))' Tue Jan 1 00:00:00 2069
We could compromize for $y+=100 if $y<69;
to freeze the behaviour to what Time::Local does in 2018, but then there might not be actual repos with such 2-digit year timestamps.
There are definitely CVS repos from before 1999 and without this change, those might be misinterpreted in 2049 (or before, depending on age)