+Fri Feb 27 01:04:47 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * configure.in, config.h.in: added test for localtime_r
+ * libexslt/date.c: added usage of localtime_r if present on
+ system (bug 129983, suggested by Vasily Tchekalkin)
+
Thu Feb 26 16:59:45 CET 2004 Daniel Veillard <daniel@veillard.com>
* libxslt/keys.c libxslt/pattern.c: removed the last use
/* Define to 1 if you have the `localtime' function. */
#undef HAVE_LOCALTIME
+/* Define to 1 if you have the `localtime_r' function. */
+#undef HAVE_LOCALTIME_R
+
/* Define to 1 if you have the <math.h> header file. */
#undef HAVE_MATH_H
/* Version number of package */
#undef VERSION
+
+/* Using the Win32 Socket implementation */
+#undef _WINSOCKAPI_
+
+/* Win32 Std C name mangling work-around */
+#undef snprintf
+
+/* Win32 Std C name mangling work-around */
+#undef vsnprintf
AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
[M_LIBS="-lm"; AC_DEFINE(HAVE_FABS)]))
AC_CHECK_FUNCS(gettimeofday)
-AC_CHECK_FUNCS(mktime localtime asctime time gmtime ftime)
+AC_CHECK_FUNCS(mktime localtime localtime_r asctime time gmtime ftime)
dnl Checking the standard string functions availability
AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
#include "config.h"
#endif
+#if HAVE_LOCALTIME_R /* _POSIX_SOURCE required by gnu libc */
+#define _POSIX_SOURCE
+#endif
+
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <string.h>
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-
#ifdef HAVE_MATH_H
#include <math.h>
#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
/*
* types of date and/or time (from schema datatypes)
* somewhat ordered from least specific to most specific (i.e.
* *
****************************************************************/
-#if defined(HAVE_TIME_H) && defined(HAVE_LOCALTIME) \
+#if defined(HAVE_TIME_H) \
+ && (defined(HAVE_LOCALTIME) || defined(HAVE_LOCALTIME_R)) \
&& defined(HAVE_TIME) && defined(HAVE_GMTIME)
#define WITH_TIME
#endif
exsltDateCurrent (void) {
struct tm *localTm, *gmTm;
time_t secs;
+#if HAVE_LOCALTIME_R
+ struct tm localTmS;
+#endif
exsltDateValPtr ret;
ret = exsltDateCreateDate(XS_DATETIME);
/* get current time */
secs = time(NULL);
+#if HAVE_LOCALTIME_R
+ localtime_r(&secs, &localTmS);
+ localTm = &localTmS;
+#else
localTm = localtime(&secs);
+#endif
/* get real year, not years since 1900 */
ret->value.date.year = localTm->tm_year + 1900;