summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qglobal_p.h3
-rw-r--r--src/corelib/tools/qdatetime.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal_p.h b/src/corelib/global/qglobal_p.h
index d52f6268e4..58bc8b7bf3 100644
--- a/src/corelib/global/qglobal_p.h
+++ b/src/corelib/global/qglobal_p.h
@@ -61,6 +61,9 @@
#endif
#if defined(__cplusplus)
+#ifdef Q_CC_MINGW
+# include <unistd.h> // Define _POSIX_THREAD_SAFE_FUNCTIONS to obtain localtime_r()
+#endif
#include <time.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 80d6dada60..511dbf0db8 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -58,6 +58,9 @@
#endif
#include <cmath>
+#ifdef Q_CC_MINGW
+# include <unistd.h> // Define _POSIX_THREAD_SAFE_FUNCTIONS to obtain localtime_r()
+#endif
#include <time.h>
#ifdef Q_OS_WIN
# include <qt_windows.h>