aboutsummaryrefslogtreecommitdiffstats
path: root/src/dateTime.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/dateTime.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/dateTime.cpp b/src/dateTime.cpp
index eaf955c3..58680791 100644
--- a/src/dateTime.cpp
+++ b/src/dateTime.cpp
@@ -655,17 +655,12 @@ datetime::datetime(const datetime& d)
datetime::datetime(const time_t t, const int zone)
{
-#if defined(_MSC_VER) || defined(__MINGW32__)
- // These functions are reentrant in MS C runtime library
- struct tm* gtm = gmtime(&t);
- struct tm* ltm = localtime(&t);
+#if VMIME_HAVE_LOCALTIME_S
struct tm tms;
- if (gtm)
- tms = *gtm;
- else if (ltm)
- tms = *ltm;
+ if (!gmtime_r(&tms, &t))
+ localtime_r(&tms, &t);
#elif VMIME_HAVE_LOCALTIME_R
struct tm tms;