diff --git a/CMakeLists.txt b/CMakeLists.txt index ac2a07cb..b787d40b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,7 @@ set(CMAKE_REQUIRED_LIBRARIES pthread rt) check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP) check_function_exists(pselect HAVE_PSELECT) check_function_exists(ppoll HAVE_PPOLL) +check_function_exists(timegm HAVE_TIMEGM) check_include_file(linux/serial.h HAVE_LINUX_SERIAL -DHAVE_LINUX_SERIAL=1) check_include_file(dev/usb/uftdiio.h HAVE_FREEBSD_UFTDI -DHAVE_FREEBSD_UFTDI=1) diff --git a/config.h.cmake b/config.h.cmake index cdcadefe..83e80bd2 100755 --- a/config.h.cmake +++ b/config.h.cmake @@ -37,6 +37,9 @@ /* Defined if time.h is available. */ #cmakedefine HAVE_TIME_H +/* Defined if timegm() is available. */ +#cmakedefine HAVE_TIMEGM + /* Defined if syslog.h is available. */ #cmakedefine HAVE_SYSLOG_H diff --git a/configure.ac b/configure.ac index df0602af..999f6ba9 100755 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,7 @@ AC_CHECK_HEADERS([arpa/inet.h \ time.h \ termios.h]) +AC_CHECK_FUNC([timegm], [AC_DEFINE(HAVE_TIMEGM, [1], [Defined if timegm() is available.])]) AC_CHECK_FUNC([cfsetspeed], [AC_DEFINE(HAVE_CFSETSPEED, [1], [Defined if cfsetspeed() is available.])]) AC_CHECK_LIB([pthread], [pthread_setname_np], diff --git a/src/lib/utils/httpclient.cpp b/src/lib/utils/httpclient.cpp index 50440491..65639514 100755 --- a/src/lib/utils/httpclient.cpp +++ b/src/lib/utils/httpclient.cpp @@ -506,7 +506,7 @@ bool* repeatable, time_t* time) { string headers = result.substr(0, pos+2); // including final \r\n const char* hdrs = headers.c_str(); *response = result.substr(pos+4); -#ifdef HAVE_TIME_H +#if defined(HAVE_TIME_H) && defined(HAVE_TIMEGM) if (time) { pos = headers.find("\r\nLast-Modified: "); if (pos != string::npos && headers.substr(pos+42, 4) == " GMT") {