From ce6b5b3ba37f6f5179408c8e3fdb2aa81ef4e41f Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 5 Dec 2011 14:41:17 +0000 Subject: [PATCH] Fix with localtime_r compat. --- compat/localtime_r.c | 14 ++++++++++++++ configure.ac | 4 ++++ 2 files changed, 18 insertions(+) create mode 100644 compat/localtime_r.c diff --git a/compat/localtime_r.c b/compat/localtime_r.c new file mode 100644 index 00000000..017c6e4d --- /dev/null +++ b/compat/localtime_r.c @@ -0,0 +1,14 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +struct tm *localtime_r(const time_t *timep, struct tm *result) +{ + /* no thread safety. */ + *result = *localtime(timep); + return result; +} diff --git a/configure.ac b/configure.ac index 9c492456..07eb4587 100644 --- a/configure.ac +++ b/configure.ac @@ -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 */ -- 2.47.3