$NetBSD: patch-ad,v 1.1.1.1 2001/04/27 14:06:05 wiz Exp $ --- unctime.y.orig Wed Dec 1 19:16:21 1999 +++ unctime.y Sun Jan 30 08:41:53 2000 @@ -80,6 +80,9 @@ # define USE_FTIME # endif #endif +#ifdef HAS_MKTIME +# define USE_MKTIME +#endif #ifdef USE_GETTOD # include @@ -331,6 +334,7 @@ /* Is y a leap year? */ #define leap(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0) +#ifndef USE_MKTIME /* Number of leap years from 1970 to y (not including y itself) */ #define nleap(y) (((y) - 1969) / 4 - ((y) - 1901) / 100 + ((y) - 1601) / 400) @@ -484,6 +488,7 @@ } #endif /* not USE_GETTOD */ +#endif /* not USE_MKTIME */ static short monthlens[] = { @@ -563,6 +568,15 @@ return -1; } +#ifdef USE_MKTIME + tm->tm_year = year - 1900; + tm->tm_mon = month - 1; + tm->tm_mday = day; + tm->tm_hour = hour; + tm->tm_min = minute; + tm->tm_sec = second; + return mktime(tm); +#else /* not USE_MKTIME */ /* Mostly for convenience in sunday() macro, we use zero-origin days. */ dayofyear = day - 1; if (month > 2 && leap(year)) @@ -581,4 +595,5 @@ - correction() #endif ; +#endif /* not USE_MKTIME */ }