On Wed, Feb 21, 2018 at 09:34:39PM +0100, H.Merijn Brand wrote: > From: "Bernhard M. Wiedemann" <bernhardout@lsmod.de> > Related: software that assumes that this will print 0 > > perl -e 'use Time::Local; print Time::Local::timelocal(localtime(0))' > > will break in 2020, because localtime returns a year of 70 and timelocal > will then interpret that as 2070. Time::Local::timelocal() is behaving as documented - special-casing 2-digit years to make it more human-readable friendly. One effect of that is that in the year 2020 onwards, trying to convert back the output of localtime(0), which returns a year value of 70 for the epoch year of 1970, will fail. Arguably Time::Local could be extended to have a couple of extra methods, such as timelocal_strict() say, which interprets the year value strictly as something that would have been returned by localtime() rather than a human-friendly fudging. Then any modules which use Time::Local and expect a safe round-trip for any year, should switch to using the new functions. -- The crew of the Enterprise encounter an alien life form which is surprisingly neither humanoid nor made from pure energy. -- Things That Never Happen in "Star Trek" #22Thread Previous