From df067c9ab68dd4913a1591f048d9baf4f1c8d09c Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 11 Feb 2021 06:20:31 -0500 Subject: Add autoconf test for localtime_r --- libqpdf/QUtil.cc | 4 ++++ libqpdf/qpdf/qpdf-config.h.in | 3 +++ 2 files changed, 7 insertions(+) (limited to 'libqpdf') diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index c5dfa74c..39d21ea0 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -844,7 +844,11 @@ QUtil::get_current_qpdf_time() struct tm ltime; time_t now = time(0); tzset(); +#ifdef HAVE_LOCALTIME_R localtime_r(&now, <ime); +#else + ltime = *localtime(&now); +#endif return QPDFTime(static_cast(ltime.tm_year + 1900), static_cast(ltime.tm_mon + 1), static_cast(ltime.tm_mday), diff --git a/libqpdf/qpdf/qpdf-config.h.in b/libqpdf/qpdf/qpdf-config.h.in index bee4cc49..78ebc86d 100644 --- a/libqpdf/qpdf/qpdf-config.h.in +++ b/libqpdf/qpdf/qpdf-config.h.in @@ -21,6 +21,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `localtime_r' function. */ +#undef HAVE_LOCALTIME_R + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H -- cgit v1.2.3-70-g09d2