]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Fix with localtime_r compat.
authorWouter Wijngaards <wouter@NLnetLabs.nl>
Mon, 5 Dec 2011 14:41:17 +0000 (14:41 +0000)
committerWouter Wijngaards <wouter@NLnetLabs.nl>
Mon, 5 Dec 2011 14:41:17 +0000 (14:41 +0000)
compat/localtime_r.c [new file with mode: 0644]
configure.ac

diff --git a/compat/localtime_r.c b/compat/localtime_r.c
new file mode 100644 (file)
index 0000000..017c6e4
--- /dev/null
@@ -0,0 +1,14 @@
+#ifdef HAVE_CONFIG_H
+#include <ldns/config.h>
+#endif
+
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+struct tm *localtime_r(const time_t *timep, struct tm *result)
+{
+       /* no thread safety. */
+       *result = *localtime(timep);
+       return result;
+}
index 9c492456277c49cb6edf4d0588524e6dae6d85e6..07eb45877d05bae5c13089fc0b42cd20d1b51ed7 100644 (file)
@@ -470,6 +470,7 @@ AC_REPLACE_FUNCS(calloc)
 AC_REPLACE_FUNCS(timegm)
 AC_REPLACE_FUNCS(gmtime_r)
 AC_REPLACE_FUNCS(ctime_r)
+AC_REPLACE_FUNCS(localtime_r)
 AC_REPLACE_FUNCS(isblank)
 AC_REPLACE_FUNCS(isascii)
 AC_REPLACE_FUNCS(inet_aton)
@@ -601,6 +602,9 @@ time_t timegm (struct tm *tm);
 #ifndef HAVE_GMTIME_R
 struct tm *gmtime_r(const time_t *timep, struct tm *result);
 #endif
+#ifndef HAVE_LOCALTIME_R
+struct tm *localtime_r(const time_t *timep, struct tm *result);
+#endif
 #ifndef HAVE_ISBLANK
 int isblank(int c);
 #endif /* !HAVE_ISBLANK */