summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qelapsedtimer_symbian.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qelapsedtimer_symbian.cpp')
-rw-r--r--src/corelib/tools/qelapsedtimer_symbian.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/corelib/tools/qelapsedtimer_symbian.cpp b/src/corelib/tools/qelapsedtimer_symbian.cpp
index 06e6f99..6360dbf 100644
--- a/src/corelib/tools/qelapsedtimer_symbian.cpp
+++ b/src/corelib/tools/qelapsedtimer_symbian.cpp
@@ -50,7 +50,15 @@ static quint64 getMillisecondFromTick()
static TInt nanokernel_tick_period;
if (!nanokernel_tick_period)
HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period);
- return nanokernel_tick_period * User::NTickCount();
+
+ static quint32 highdword = 0;
+ static quint32 lastval = 0;
+ quint32 val = User::NTickCount();
+ if (val < lastval)
+ ++highdword;
+ lastval = val;
+
+ return nanokernel_tick_period * (val | (quint64(highdword) << 32));
}
QElapsedTimer::ClockType QElapsedTimer::clockType()
@@ -58,18 +66,6 @@ QElapsedTimer::ClockType QElapsedTimer::clockType()
return TickCounter;
}
-static qint64 difference(qint64 a, qint64 b)
-{
- qint64 retval = a - b;
- // there can be 32-bit rollover
- // assume there were rollovers if the difference is negative by more than
- // 75% of the 32-bit range
-
- if (retval < Q_INT64_C(-0xc0000000))
- retval += Q_UINT64_C(0x100000000);
- return retval;
-}
-
bool QElapsedTimer::isMonotonic()
{
return true;
@@ -85,12 +81,13 @@ qint64 QElapsedTimer::restart()
{
qint64 oldt1 = t1;
t1 = getMillisecondFromTick();
- return difference(t1, oldt1);
+ t2 = 0;
+ return t1 - oldt1;
}
qint64 QElapsedTimer::elapsed() const
{
- return difference(getMillisecondFromTick(), t1);
+ return getMillisecondFromTick() - t1;
}
qint64 QElapsedTimer::msecsSinceReference() const
@@ -100,7 +97,7 @@ qint64 QElapsedTimer::msecsSinceReference() const
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
{
- return difference(other.t1, t1);
+ return other.t1 - t1;
}
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const
@@ -110,7 +107,7 @@ qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2)
{
- return difference(v1.t1, v2.t1) < 0;
+ return (v1.t1 - v2.t1) < 0;
}
QT_END_NAMESPACE