aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-11 12:20:31 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-11 20:26:55 +0100
commitdf067c9ab68dd4913a1591f048d9baf4f1c8d09c (patch)
tree12234b02bac3443fbef15e2272219d13df30e8d9 /libqpdf
parent2538d84413ac574f6f8bcb9dfcc84254a11fa75d (diff)
downloadqpdf-df067c9ab68dd4913a1591f048d9baf4f1c8d09c.tar.zst
Add autoconf test for localtime_r
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QUtil.cc4
-rw-r--r--libqpdf/qpdf/qpdf-config.h.in3
2 files changed, 7 insertions, 0 deletions
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, &ltime);
+#else
+ ltime = *localtime(&now);
+#endif
return QPDFTime(static_cast<int>(ltime.tm_year + 1900),
static_cast<int>(ltime.tm_mon + 1),
static_cast<int>(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 <inttypes.h> 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 <memory.h> header file. */
#undef HAVE_MEMORY_H