q5: 'QTime::currentTime()' fix

Fixes #1298
This commit is contained in:
Christian Prochaska 2014-11-21 20:27:01 +01:00 committed by Christian Helmuth
parent 703e3622ff
commit 2f5fbe73d3
2 changed files with 21 additions and 12 deletions

View File

@ -1 +1 @@
1cc6ac41503ff58bb06dfc142a51a9a57506d748 2c75a650936656dc846dac362ff43e1d19a21c7f

View File

@ -15,14 +15,14 @@ Genode-specific adaptations
qtbase/src/corelib/kernel/qtranslator.cpp | 2 - qtbase/src/corelib/kernel/qtranslator.cpp | 2 -
qtbase/src/corelib/thread/qthread.cpp | 5 +- qtbase/src/corelib/thread/qthread.cpp | 5 +-
qtbase/src/corelib/thread/qthread_p.h | 55 +++++++++++++++++ qtbase/src/corelib/thread/qthread_p.h | 55 +++++++++++++++++
qtbase/src/corelib/tools/qdatetime.cpp | 12 ++++ qtbase/src/corelib/tools/qdatetime.cpp | 15 +++++
qtbase/src/gui/image/qxpmhandler.cpp | 8 +++ qtbase/src/gui/image/qxpmhandler.cpp | 8 +++
.../network/access/qnetworkaccessfilebackend.cpp | 5 ++ .../network/access/qnetworkaccessfilebackend.cpp | 5 ++
qtbase/src/network/kernel/qhostinfo.cpp | 5 ++ qtbase/src/network/kernel/qhostinfo.cpp | 5 ++
qtbase/src/network/kernel/qhostinfo_unix.cpp | 7 ++ qtbase/src/network/kernel/qhostinfo_unix.cpp | 7 ++
qtbase/src/widgets/dialogs/qfiledialog.cpp | 2 - qtbase/src/widgets/dialogs/qfiledialog.cpp | 2 -
qtbase/src/widgets/styles/qstylefactory.cpp | 7 ++ qtbase/src/widgets/styles/qstylefactory.cpp | 7 ++
18 files changed, 242 insertions(+), 8 deletions(-) 18 files changed, 245 insertions(+), 8 deletions(-)
diff --git a/qtbase/src/corelib/codecs/qtextcodec.cpp b/qtbase/src/corelib/codecs/qtextcodec.cpp diff --git a/qtbase/src/corelib/codecs/qtextcodec.cpp b/qtbase/src/corelib/codecs/qtextcodec.cpp
index 1cedd3a..646be07 100644 index 1cedd3a..646be07 100644
@ -420,28 +420,37 @@ index 9d773b3..9beb7e6 100644
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
diff --git a/qtbase/src/corelib/tools/qdatetime.cpp b/qtbase/src/corelib/tools/qdatetime.cpp diff --git a/qtbase/src/corelib/tools/qdatetime.cpp b/qtbase/src/corelib/tools/qdatetime.cpp
index d8e3a78..6a579e9 100644 index d8e3a78..78202c6 100644
--- a/qtbase/src/corelib/tools/qdatetime.cpp --- a/qtbase/src/corelib/tools/qdatetime.cpp
+++ b/qtbase/src/corelib/tools/qdatetime.cpp +++ b/qtbase/src/corelib/tools/qdatetime.cpp
@@ -3072,6 +3072,9 @@ QTime QTime::currentTime() @@ -3072,9 +3072,14 @@ QTime QTime::currentTime()
// posix compliant system // posix compliant system
struct timeval tv; struct timeval tv;
gettimeofday(&tv, 0); gettimeofday(&tv, 0);
+#ifdef Q_OS_GENODE +
+ ct.mds = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+#else
time_t ltime = tv.tv_sec; time_t ltime = tv.tv_sec;
struct tm *t = 0; struct tm *t = 0;
@@ -3086,6 +3089,7 @@ QTime QTime::currentTime() +#ifdef Q_OS_GENODE
+ struct tm res;
+ t = gmtime_r(&ltime, &res);
+#else /* Q_OS_GENODE */
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// use the reentrant version of localtime() where available
tzset();
@@ -3083,9 +3088,11 @@ QTime QTime::currentTime()
#else
t = localtime(&ltime);
#endif
+#endif /* Q_OS_GENODE */
Q_CHECK_PTR(t); Q_CHECK_PTR(t);
ct.mds = msecsFromDecomposed(t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec / 1000); ct.mds = msecsFromDecomposed(t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec / 1000);
+#endif /* Q_OS_GENODE */ +
return ct; return ct;
} }
@@ -3970,6 +3974,10 @@ static QDate adjustDate(QDate date) @@ -3970,6 +3977,10 @@ static QDate adjustDate(QDate date)
static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time)
{ {
@ -452,7 +461,7 @@ index d8e3a78..6a579e9 100644
QDate fakeDate = adjustDate(date); QDate fakeDate = adjustDate(date);
// won't overflow because of fakeDate // won't overflow because of fakeDate
@@ -4023,6 +4031,10 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) @@ -4023,6 +4034,10 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time)
static void localToUtc(QDate &date, QTime &time, int isdst) static void localToUtc(QDate &date, QTime &time, int isdst)
{ {