summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qdatetime.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 83db1c3cc9..31c870b012 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -4045,6 +4045,16 @@ static void localToUtc(QDate &date, QTime &time, int isdst)
_tzset();
#endif
time_t secsSince1Jan1970UTC = mktime(&localTM);
+#ifdef Q_OS_QNX
+ //mktime sometimes fails on QNX. Following workaround converts the date and time then manually
+ if (secsSince1Jan1970UTC == (time_t)-1) {
+ QDateTime tempTime = QDateTime(date, time, Qt::UTC);;
+ tempTime = tempTime.addMSecs(timezone * 1000);
+ date = tempTime.date();
+ time = tempTime.time();
+ return;
+ }
+#endif
#endif
tm *brokenDown = 0;
#if defined(Q_OS_WINCE)