From f994a62c5b10fe113762561b0bcd87501356d4f8 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 2 Mar 2010 10:02:41 +0100 Subject: [PATCH 1/3] [cpp] Use gmtime() when gmtime_r() is not available --- cpp/tests/poppler-dump.cpp | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cpp/tests/poppler-dump.cpp b/cpp/tests/poppler-dump.cpp index 693d107..01511f3 100644 --- a/cpp/tests/poppler-dump.cpp +++ b/cpp/tests/poppler-dump.cpp @@ -82,10 +82,15 @@ static std::string out_ustring(const poppler::ustring &str) static std::string out_date(std::time_t date) { if (date != std::time_t(-1)) { + struct tm *gt; +#ifdef HAVE_GMTIME_R struct tm time; - gmtime_r(&date, &time); + gt = gmtime_r(&date, &time); +#else + gt = gmtime (&date); +#endif char buf[32]; - strftime(buf, sizeof(buf) - 1, "%d/%m/%Y %H:%M:%S", &time); + strftime(buf, sizeof(buf) - 1, "%d/%m/%Y %H:%M:%S", gt); return std::string(buf); } return std::string("n/a"); -- 1.6.4.2