Subject: Re: lib/10521: y2k bug in mktime
To: Wolfgang Rupprecht <email@example.com>
From: Andrew Brown <firstname.lastname@example.org>
Date: 07/06/2000 10:03:40
> there is a y2k bug in mktime. It refuses to convert tm
> structs where the year is set to 1996. The number 96 works
> just fine.
that's because the tm_year member of struct tm is defined to be the
number of years since 1900. man localtime(3). the programmer is
expected to convert dates to this format.
> if (tm.tm_year > 100)
> tm.tm_year %= 100;
not that. perhap something like
if (tm.tm_year > 1900)
tm.tm_year %= 1900;
although that's not specifically correct. someone will soon want to
be able to represent april 1, 3048ad in a time_t and lose.
|-----< "CODE WARRIOR" >-----|
email@example.com * "ah! i see you have the internet
firstname.lastname@example.org (Andrew Brown) that goes *ping*!"
email@example.com * "information is power -- share the wealth."