Subject: Re: lib/10521: y2k bug in mktime
To: Wolfgang Rupprecht <wolfgang@wsrcc.com>
From: Andrew Brown <atatat@atatdot.net>
List: netbsd-bugs
Date: 07/06/2000 10:03:40
>>Description:
>	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.

>#ifdef __NetBSD__
>		if (tm.tm_year > 100)
>		    tm.tm_year %= 100;
>#endif

not that.  perhap something like

#ifdef __NetBSD__
		if (tm.tm_year > 1900)
		    tm.tm_year %= 1900;
#endif

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" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."