diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-17 15:03:23 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-18 12:42:16 +0000 |
commit | 8ae8c6690b41f6cd40dae14d471ce29b500c66c9 (patch) | |
tree | 6014b3b6becc9602a7b1419727b192c65584b386 /src | |
parent | 9d67bf6e9635505bd9523a3007f8e531f890c88f (diff) |
MinGW: Fix developer build
In some build configurations, the build with MinGW would fail due to missing
declaration of localtime_r(). This is only visible when
_POSIX_THREAD_SAFE_FUNCTIONS is defined, which is achieved by including
<unistd.h>. Amends 6c543879a31d7d13a6b87e6332f6913f2f89f5e6.
Task-number: QTBUG-71030
Change-Id: I71296f24a450159d1c548e1ad836a2b42e42009f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qglobal_p.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 3 |
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> |