aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dateTime.cpp5
-rw-r--r--src/platforms/posix/posixHandler.cpp4
-rw-r--r--src/platforms/windows/windowsHandler.cpp10
3 files changed, 13 insertions, 6 deletions
diff --git a/src/dateTime.cpp b/src/dateTime.cpp
index feb18718..f98d7c64 100644
--- a/src/dateTime.cpp
+++ b/src/dateTime.cpp
@@ -23,6 +23,7 @@
#include <iomanip>
+#include "vmime/config.hpp"
#include "vmime/dateTime.hpp"
#include "vmime/platform.hpp"
#include "vmime/parserHelpers.hpp"
@@ -663,7 +664,7 @@ datetime::datetime(const time_t t, const int zone)
tms = *gtm;
else if (ltm)
tms = *ltm;
-#elif defined(_REENTRANT)
+#elif VMIME_HAVE_LOCALTIME_R
struct tm tms;
if (!gmtime_r(&t, &tms))
@@ -678,7 +679,7 @@ datetime::datetime(const time_t t, const int zone)
tms = *gtm;
else if (ltm)
tms = *ltm;
-#endif // _REENTRANT
+#endif
m_year = tms.tm_year + 1900;
m_month = tms.tm_mon + 1;
diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp
index d90b316c..6536b5ef 100644
--- a/src/platforms/posix/posixHandler.cpp
+++ b/src/platforms/posix/posixHandler.cpp
@@ -132,7 +132,7 @@ const vmime::datetime posixHandler::getCurrentLocalTime() const
const time_t t(::time(NULL));
// Get the local time
-#ifdef _REENTRANT
+#if VMIME_HAVE_LOCALTIME_R
tm local;
::localtime_r(&t, &local);
#else
@@ -140,7 +140,7 @@ const vmime::datetime posixHandler::getCurrentLocalTime() const
#endif
// Get the UTC time
-#ifdef _REENTRANT
+#if VMIME_HAVE_GMTIME_R
tm gmt;
::gmtime_r(&t, &gmt);
#else
diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp
index b1ab87fa..6583cab1 100644
--- a/src/platforms/windows/windowsHandler.cpp
+++ b/src/platforms/windows/windowsHandler.cpp
@@ -79,7 +79,10 @@ const vmime::datetime windowsHandler::getCurrentLocalTime() const
const time_t t(::time(NULL));
// Get the local time
-#if defined(_REENTRANT) && defined(localtime_r)
+#if VMIME_HAVE_LOCALTIME_S
+ tm local;
+ ::localtime_s(&local, &t);
+#elif VMIME_HAVE_LOCALTIME_R
tm local;
::localtime_r(&t, &local);
#else
@@ -87,7 +90,10 @@ const vmime::datetime windowsHandler::getCurrentLocalTime() const
#endif
// Get the UTC time
-#if defined(_REENTRANT) && defined(gmtime_r)
+#if VMIME_HAVE_GMTIME_S
+ tm gmt;
+ ::gmtime_s(&gmt, &t);
+#elif VMIME_HAVE_GMTIME_R
tm gmt;
::gmtime_r(&t, &gmt);
#else