check for timegm()

This commit is contained in:
John
2023-10-01 23:42:56 +02:00
parent fe49e9b67f
commit 28bebfa49d
4 changed files with 6 additions and 1 deletions
+1
View File
@@ -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)
+3
View File
@@ -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
+1
View File
@@ -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],
+1 -1
View File
@@ -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") {