From d53d0412e014872b71dd9c91727234de4f08fb2f Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 14 Dec 2016 02:49:55 +0100 Subject: Properly check for the availability of strptime() and make sure to use it --- configure.ac | 2 +- src/xplist.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d100b81..4eb1032 100644 --- a/configure.ac +++ b/configure.ac @@ -48,7 +48,7 @@ AC_TYPE_UINT32_T AC_TYPE_UINT8_T # Checks for library functions. -AC_CHECK_FUNCS([asprintf strcasecmp strdup strerror strndup stpcpy vasprintf gmtime_r localtime_r timegm]) +AC_CHECK_FUNCS([asprintf strcasecmp strdup strerror strndup stpcpy vasprintf gmtime_r localtime_r timegm strptime]) # Checking endianness AC_C_BIGENDIAN([AC_DEFINE([__BIG_ENDIAN__], [1], [big endian])], diff --git a/src/xplist.c b/src/xplist.c index dc824e2..43b0422 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -25,6 +25,10 @@ #include #endif +#ifdef HAVE_STRPTIME +#define _XOPEN_SOURCE 600 +#endif + #include #include #include @@ -354,7 +358,7 @@ static void parse_date(const char *strval, struct TM *btime) if (!btime) return; memset(btime, 0, sizeof(struct tm)); if (!strval) return; -#ifdef strptime +#ifdef HAVE_STRPTIME strptime((char*)strval, "%Y-%m-%dT%H:%M:%SZ", btime); #else #ifdef USE_TM64 -- cgit v1.1-32-gdbae