aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4dateobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4dateobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index cfc4843ec9..688730af9b 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -295,6 +295,13 @@ static inline double DaylightSavingTA(double t)
__time64_t tt = (__time64_t)(t / msPerSecond);
// _localtime_64_s returns non-zero on failure
if (_localtime64_s(&tmtm, &tt) != 0)
+#elif defined(Q_CC_MINGW) && !defined(__MINGW64_VERSION_MAJOR)
+ // mingw.org headers do not define localtime_r.
+ // luckily Windows localtime() is thread safe.
+ long int tt = (long int)(t / msPerSecond);
+ if (struct tm *tmtm_p = localtime((const time_t*) &tt))
+ tmtm = *tmtm_p;
+ else
#else
long int tt = (long int)(t / msPerSecond);
if (!localtime_r((const time_t*) &tt, &tmtm))