diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-05-31 15:57:14 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2011-06-01 13:50:04 (GMT) |
commit | f8d71ee8c5f29eabb759ff4b0d5c8a153023a254 (patch) | |
tree | 9b3c39c2495e73a0736efdc034e942f095b3a812 | |
parent | fbe0d24bdd429248dbf9e9be592f15fd7b1648bc (diff) | |
download | Qt-f8d71ee8c5f29eabb759ff4b0d5c8a153023a254.zip Qt-f8d71ee8c5f29eabb759ff4b0d5c8a153023a254.tar.gz Qt-f8d71ee8c5f29eabb759ff4b0d5c8a153023a254.tar.bz2 |
QDeclarative: Fix QPerformanceTimer on Symbian
QPerformanceTimer::elapsed() always returned 0 on Symbian. This
is because Q_OS_UNIX define is also set for Symbian. Fixed by moving
Q_OS_SYMBIAN before Q_OS_SYMBIAN, and fixing the logic.
Reviewed-by: Alessandro Portale
Task-number: QTBUG-19669
-rw-r--r-- | src/declarative/declarative.pro | 2 | ||||
-rw-r--r-- | src/declarative/qml/qperformancetimer.cpp | 55 |
2 files changed, 29 insertions, 28 deletions
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index f3a7db9..27ceaf0 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -26,7 +26,7 @@ include(debugger/debugger.pri) symbian: { TARGET.UID3=0x2001E623 - LIBS += -lefsrv + LIBS += -lefsrv -lhal } linux-g++-maemo:DEFINES += QDECLARATIVEVIEW_NOBACKGROUND diff --git a/src/declarative/qml/qperformancetimer.cpp b/src/declarative/qml/qperformancetimer.cpp index 1d7ca80..bdd5da1 100644 --- a/src/declarative/qml/qperformancetimer.cpp +++ b/src/declarative/qml/qperformancetimer.cpp @@ -45,14 +45,15 @@ #include <sys/time.h> #include <unistd.h> #include <mach/mach_time.h> -#elif defined(Q_OS_UNIX) -#include <sys/time.h> -#include <time.h> -#include <unistd.h> #elif defined(Q_OS_SYMBIAN) #include <e32std.h> #include <sys/time.h> #include <hal.h> +#include <hal_data.h> +#elif defined(Q_OS_UNIX) +#include <sys/time.h> +#include <time.h> +#include <unistd.h> #elif defined(Q_OS_WIN) #include <windows.h> #endif @@ -84,6 +85,29 @@ qint64 QPerformanceTimer::elapsed() const return absoluteToNSecs(cpu_time - t1); } +////////////////////////////// Symbian ////////////////////////////// +#elif defined(Q_OS_SYMBIAN) + +static qint64 getTimeFromTick(quint64 elapsed) +{ + static TInt freq = 0; + if (!freq) + HAL::Get(HALData::EFastCounterFrequency, freq); + + return (elapsed * 1000000000) / freq; +} + +void QPerformanceTimer::start() +{ + t1 = User::FastCounter(); +} + +qint64 QPerformanceTimer::elapsed() const +{ + return getTimeFromTick(User::FastCounter() - t1); +} + + ////////////////////////////// Unix ////////////////////////////// #elif defined(Q_OS_UNIX) @@ -158,29 +182,6 @@ qint64 QPerformanceTimer::elapsed() const return sec * Q_INT64_C(1000000000) + frac; } -////////////////////////////// Symbian ////////////////////////////// -#elif defined(Q_OS_SYMBIAN) - -static qint64 getTimeFromTick(quint64 elapsed) -{ - static TInt freq; - if (!freq) - HAL::Get(HALData::EFastCounterFrequency, freq); - - // ### not sure on units - return elapsed / freq; -} - -void QPerformanceTimer::start() -{ - t1 = User::FastCounter(); -} - -qint64 QPerformanceTimer::elapsed() const -{ - return getTimeFromTick(User::FastCounter() - t1); -} - ////////////////////////////// Windows ////////////////////////////// #elif defined(Q_OS_WIN) |