On Fri, Oct 31, 2003 at 12:40:52AM -0000, derek@dongray.fsnet.co.uk (via RT) wrote: > At 00:35:26 31 oct 2003 GMT, the one-liner: > > perl -e '@l=gmtime();for(@l){print;print qq{ }}' > > produces: > > 26 35 0 31 9 103 5 303 0 > > I.e. the year is returned as 103 instead of 2003. > localtime() produces the same result. This is, alas, how localtime() and gmtime() work. :( $year is the number of years since 1900. That is, $year is 123 in year 2023. This is because Perl's localtime() parrots the interface of C's localtime(). Presumably C did it that way so that it could fit the year in 8 bits (ie. 0 to 255). -- Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern/ Do not try comedy at home! Milk & Cheese are advanced experts! Attempts at comedy can be dangerously unfunny!Thread Previous