X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmktime.c;h=5a17eecc60f7f5c24158ea5c0e2bc6679d07b44e;hb=7f5a14a4366b8696b9f58cc78d8b3a02912ffc6d;hp=02acc5206797b0bb93bb04f5dd4cdfa41e9b7589;hpb=c80984f8e3a13a265c826301e53585ad87bd761b;p=gnulib.git diff --git a/lib/mktime.c b/lib/mktime.c index 02acc5206..5a17eecc6 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -106,22 +106,15 @@ const unsigned short int __mon_yday[2][13] = }; -#ifdef _LIBC -# define my_mktime_localtime_r __localtime_r -#else -/* If we're a mktime substitute in a GNU program, then prefer - localtime to localtime_r, since many localtime_r implementations - are buggy. */ -static struct tm * -my_mktime_localtime_r (const time_t *t, struct tm *tp) -{ - struct tm *l = localtime (t); - if (! l) - return 0; - *tp = *l; - return tp; -} -#endif /* ! _LIBC */ +#ifndef _LIBC +/* Portable standalone applications should supply a "time_r.h" that + declares a POSIX-compliant localtime_r, for the benefit of older + implementations that lack localtime_r or have a nonstandard one. + See the gnulib time_r module for one way to implement this. */ +# include "time_r.h" +# undef __localtime_r +# define __localtime_r localtime_r +#endif /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) - (YEAR0-YDAY0 HOUR0:MIN0:SEC0) in seconds, assuming that the clocks @@ -244,9 +237,6 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *), Use *OFFSET to keep track of a guess at the offset of the result, compared to what the result would be for UTC without leap seconds. If *OFFSET's guess is correct, only one CONVERT call is needed. */ -#ifndef _LIBC -static -#endif time_t __mktime_internal (struct tm *tp, struct tm *(*convert) (const time_t *, struct tm *), @@ -486,7 +476,7 @@ mktime (struct tm *tp) __tzset (); #endif - return __mktime_internal (tp, my_mktime_localtime_r, &localtime_offset); + return __mktime_internal (tp, __localtime_r, &localtime_offset); } #ifdef weak_alias