Commit d53d0412 authored by Nikias Bassen's avatar Nikias Bassen

Properly check for the availability of strptime() and make sure to use it

parent ae8b7a0f
...@@ -48,7 +48,7 @@ AC_TYPE_UINT32_T ...@@ -48,7 +48,7 @@ AC_TYPE_UINT32_T
AC_TYPE_UINT8_T AC_TYPE_UINT8_T
# Checks for library functions. # 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 # Checking endianness
AC_C_BIGENDIAN([AC_DEFINE([__BIG_ENDIAN__], [1], [big endian])], AC_C_BIGENDIAN([AC_DEFINE([__BIG_ENDIAN__], [1], [big endian])],
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#include <config.h> #include <config.h>
#endif #endif
#ifdef HAVE_STRPTIME
#define _XOPEN_SOURCE 600
#endif
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -354,7 +358,7 @@ static void parse_date(const char *strval, struct TM *btime) ...@@ -354,7 +358,7 @@ static void parse_date(const char *strval, struct TM *btime)
if (!btime) return; if (!btime) return;
memset(btime, 0, sizeof(struct tm)); memset(btime, 0, sizeof(struct tm));
if (!strval) return; if (!strval) return;
#ifdef strptime #ifdef HAVE_STRPTIME
strptime((char*)strval, "%Y-%m-%dT%H:%M:%SZ", btime); strptime((char*)strval, "%Y-%m-%dT%H:%M:%SZ", btime);
#else #else
#ifdef USE_TM64 #ifdef USE_TM64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment