Subject: Re: lib/10521: y2k bug in mktime
To: Wolfgang Rupprecht <>
From: Andrew Brown <>
List: netbsd-bugs
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.

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

not that.  perhap something like

#ifdef __NetBSD__
		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" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."