summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-03-05 18:03:51 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-03-17 10:54:20 (GMT)
commite62a99d588eaf2b7443250f36c42762a0631c02a (patch)
tree4e5435b98dc77d85e132eda8209a2e4eeec6931d /src/corelib
parent73d10fd0813b19ad71e76419d78bf6e2dfd312d7 (diff)
downloadQt-e62a99d588eaf2b7443250f36c42762a0631c02a.zip
Qt-e62a99d588eaf2b7443250f36c42762a0631c02a.tar.gz
Qt-e62a99d588eaf2b7443250f36c42762a0631c02a.tar.bz2
Bugfix the Symbian implementation
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qdatetime.cpp4
-rw-r--r--src/corelib/tools/qelapsedtimer_symbian.cpp20
-rw-r--r--src/corelib/tools/tools.pri2
3 files changed, 22 insertions, 4 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 7e03777..54a4205 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2953,8 +2953,8 @@ qint64 QDateTime::currentMsecsSinceEpoch()
qint64 value = gmTime.Int64();
// whereas 1970-01-01T00:00:00 is (in the same representation):
- static const qint64 unixEpoch = qint64(1970 * 365 + 1970 / 4 - 1970 / 100 + 1970 / 400) * Q_INT64_C(86400)
- * Q_INT64_C(1000000);
+ // ((1970 * 365) + (1970 / 4) - (1970 / 100) + (1970 / 400) - 13) * 86400 * 1000000
+ static const qint64 unixEpoch = Q_INT64_C(0xdcddb30f2f8000);
return (value - unixEpoch) / 1000;
}
diff --git a/src/corelib/tools/qelapsedtimer_symbian.cpp b/src/corelib/tools/qelapsedtimer_symbian.cpp
index 6360dbf..038b102 100644
--- a/src/corelib/tools/qelapsedtimer_symbian.cpp
+++ b/src/corelib/tools/qelapsedtimer_symbian.cpp
@@ -40,12 +40,15 @@
****************************************************************************/
#include "qelapsedtimer.h"
+#include "qpair.h"
#include <e32std.h>
+#include <sys/time.h>
+#include <hal.h>
QT_BEGIN_NAMESPACE
// return quint64 to avoid sign-extension
-static quint64 getMillisecondFromTick()
+static quint64 getMicrosecondFromTick()
{
static TInt nanokernel_tick_period;
if (!nanokernel_tick_period)
@@ -61,6 +64,21 @@ static quint64 getMillisecondFromTick()
return nanokernel_tick_period * (val | (quint64(highdword) << 32));
}
+static quint64 getMillisecondFromTick()
+{
+ return getMicrosecondFromTick() / 1000;
+}
+
+timeval qt_gettime()
+{
+ timeval tv;
+ quint64 now = getMicrosecondFromTick();
+ tv.tv_sec = now / 1000000;
+ tv.tv_usec = now % 1000000;
+
+ return tv;
+}
+
QElapsedTimer::ClockType QElapsedTimer::clockType()
{
return TickCounter;
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 73dae7a..4e0ebbc 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -84,7 +84,7 @@ SOURCES += \
symbian:SOURCES+=tools/qlocale_symbian.cpp
mac:SOURCES += tools/qelapsedtimer_mac.cpp
-else:symbian:SOURCES += tools/qelapsedtimer_generic.cpp
+else:symbian:SOURCES += tools/qelapsedtimer_symbian.cpp
else:unix:SOURCES += tools/qelapsedtimer_unix.cpp
else:win32:SOURCES += tools/qelapsedtimer_win.cpp
else:SOURCES += tools/qelapsedtimer_generic.cpp