summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-02-26 14:02:26 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-03-17 10:54:19 (GMT)
commit21983be486af0d252b8d393ed36b15becb3c8824 (patch)
tree84501a18ef84aac2f186452741ac93f229090894 /src/corelib/tools
parente0c97f943e80488c7e674075d40a27822b7e8c78 (diff)
downloadQt-21983be486af0d252b8d393ed36b15becb3c8824.zip
Qt-21983be486af0d252b8d393ed36b15becb3c8824.tar.gz
Qt-21983be486af0d252b8d393ed36b15becb3c8824.tar.bz2
Rename QTimestamp to QElapsedTimer
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qdatetime.h2
-rw-r--r--src/corelib/tools/qtimeline.cpp4
-rw-r--r--src/corelib/tools/qtimestamp.cpp8
-rw-r--r--src/corelib/tools/qtimestamp.h12
-rw-r--r--src/corelib/tools/qtimestamp_generic.cpp16
-rw-r--r--src/corelib/tools/qtimestamp_mac.cpp16
-rw-r--r--src/corelib/tools/qtimestamp_symbian.cpp16
-rw-r--r--src/corelib/tools/qtimestamp_unix.cpp24
-rw-r--r--src/corelib/tools/qtimestamp_win.cpp16
-rw-r--r--src/corelib/tools/tools.pri12
10 files changed, 63 insertions, 63 deletions
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index 75b5985..cb7f5bd 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -204,7 +204,7 @@ private:
friend class QDateTime;
friend class QDateTimePrivate;
- friend class QTimestamp;
+ friend class QElapsedTimer;
#ifndef QT_NO_DATASTREAM
friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QTime &);
friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &);
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp
index 57977bc..f413223 100644
--- a/src/corelib/tools/qtimeline.cpp
+++ b/src/corelib/tools/qtimeline.cpp
@@ -44,7 +44,7 @@
#include <private/qobject_p.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qmath.h>
-#include <QtCore/qtimestamp.h>
+#include <QtCore/qelapsedtimer.h>
QT_BEGIN_NAMESPACE
@@ -70,7 +70,7 @@ public:
int currentTime;
int timerId;
- QTimestamp timer;
+ QElapsedTimer timer;
QTimeLine::Direction direction;
QEasingCurve easingCurve;
diff --git a/src/corelib/tools/qtimestamp.cpp b/src/corelib/tools/qtimestamp.cpp
index b861099..220b108 100644
--- a/src/corelib/tools/qtimestamp.cpp
+++ b/src/corelib/tools/qtimestamp.cpp
@@ -39,23 +39,23 @@
**
****************************************************************************/
-#include "qtimestamp.h"
+#include "qelapsedtimer.h"
QT_BEGIN_NAMESPACE
static const qint64 invalidData = Q_INT64_C(0x8000000000000000);
-void QTimestamp::invalidate()
+void QElapsedTimer::invalidate()
{
t1 = t2 = invalidData;
}
-bool QTimestamp::isValid() const
+bool QElapsedTimer::isValid() const
{
return t1 != invalidData && t2 != invalidData;
}
-bool QTimestamp::hasExpired(qint64 timeout) const
+bool QElapsedTimer::hasExpired(qint64 timeout) const
{
// if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be
// considered as never expired
diff --git a/src/corelib/tools/qtimestamp.h b/src/corelib/tools/qtimestamp.h
index de87ad8..4fa0ca5 100644
--- a/src/corelib/tools/qtimestamp.h
+++ b/src/corelib/tools/qtimestamp.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
-class Q_CORE_EXPORT QTimestamp
+class Q_CORE_EXPORT QElapsedTimer
{
public:
static bool isMonotonic();
@@ -63,15 +63,15 @@ public:
qint64 elapsed() const;
bool hasExpired(qint64 timeout) const;
- qint64 msecsTo(const QTimestamp &other) const;
- qint64 secsTo(const QTimestamp &other) const;
+ qint64 msecsTo(const QElapsedTimer &other) const;
+ qint64 secsTo(const QElapsedTimer &other) const;
- bool operator==(const QTimestamp &other) const
+ bool operator==(const QElapsedTimer &other) const
{ return t1 == other.t1 && t2 == other.t2; }
- bool operator!=(const QTimestamp &other) const
+ bool operator!=(const QElapsedTimer &other) const
{ return !(*this == other); }
- friend bool Q_CORE_EXPORT operator<(const QTimestamp &v1, const QTimestamp &v2);
+ friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &v1, const QElapsedTimer &v2);
private:
qint64 t1;
diff --git a/src/corelib/tools/qtimestamp_generic.cpp b/src/corelib/tools/qtimestamp_generic.cpp
index c80ac34..a9c2233 100644
--- a/src/corelib/tools/qtimestamp_generic.cpp
+++ b/src/corelib/tools/qtimestamp_generic.cpp
@@ -39,24 +39,24 @@
**
****************************************************************************/
-#include "qtimestamp.h"
+#include "qelapsedtimer.h"
#include "qdatetime.h"
QT_BEGIN_NAMESPACE
-bool QTimestamp::isMonotonic()
+bool QElapsedTimer::isMonotonic()
{
return false;
}
-void QTimestamp::start()
+void QElapsedTimer::start()
{
QTime t = QTime::currentTime();
t1 = t.mds;
t2 = 0;
}
-qint64 QTimestamp::restart()
+qint64 QElapsedTimer::restart()
{
QTime t = QTime::currentTime();
qint64 old = t1;
@@ -64,13 +64,13 @@ qint64 QTimestamp::restart()
return t1 - old;
}
-qint64 QTimestamp::elapsed() const
+qint64 QElapsedTimer::elapsed() const
{
QTime t = QTime::currentTime();
return t.mds - t1;
}
-qint64 QTimestamp::msecsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
{
qint64 diff = other.t1 - t1;
if (diff < 0) // passed midnight
@@ -78,12 +78,12 @@ qint64 QTimestamp::msecsTo(const QTimestamp &other) const
return diff;
}
-qint64 QTimestamp::secsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const
{
return msecsTo(other) / 1000;
}
-bool operator<(const QTimestamp &v1, const QTimestamp &v2)
+bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2)
{
return v1.t1 < v2.t1;
}
diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp
index 02f0fa7..21a6d1b 100644
--- a/src/corelib/tools/qtimestamp_mac.cpp
+++ b/src/corelib/tools/qtimestamp_mac.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qtimestamp.h"
+#include "qelapsedtimer.h"
#include <sys/time.h>
#include <unistd.h>
@@ -47,7 +47,7 @@
QT_BEGIN_NAMESPACE
-bool QTimestamp::isMonotonic()
+bool QElapsedTimer::isMonotonic()
{
return true;
}
@@ -77,13 +77,13 @@ timeval qt_gettime()
return tv;
}
-void QTimestamp::start()
+void QElapsedTimer::start()
{
t1 = mach_absolute_time();
t2 = 0;
}
-qint64 QTimestamp::restart()
+qint64 QElapsedTimer::restart()
{
qint64 old = t1;
t1 = mach_absolute_time();
@@ -91,23 +91,23 @@ qint64 QTimestamp::restart()
return absoluteToMSecs(t1 - old);
}
-qint64 QTimestamp::elapsed() const
+qint64 QElapsedTimer::elapsed() const
{
uint64_t cpu_time = mach_absolute_time();
return absoluteToMSecs(cpu_time - t1);
}
-qint64 QTimestamp::msecsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
{
return absoluteToMSecs(other.t1 - t1);
}
-qint64 QTimestamp::secsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const
{
return msecsTo(other) / 1000;
}
-bool operator<(const QTimestamp &v1, const QTimestamp &v2)
+bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2)
{
return v1.t1 < v2.t1;
}
diff --git a/src/corelib/tools/qtimestamp_symbian.cpp b/src/corelib/tools/qtimestamp_symbian.cpp
index 1d7b6ff..1fbba65 100644
--- a/src/corelib/tools/qtimestamp_symbian.cpp
+++ b/src/corelib/tools/qtimestamp_symbian.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qtimestamp.h"
+#include "qelapsedtimer.h"
#include <e32std.h>
QT_BEGIN_NAMESPACE
@@ -65,40 +65,40 @@ static qint64 difference(qint64 a, qint64 b)
return retval;
}
-bool QTimestamp::isMonotonic()
+bool QElapsedTimer::isMonotonic()
{
return true;
}
-void QTimestamp::start()
+void QElapsedTimer::start()
{
t1 = getMillisecondFromTick();
t2 = 0;
}
-qint64 QTimestamp::restart()
+qint64 QElapsedTimer::restart()
{
qint64 oldt1 = t1;
t1 = getMillisecondFromTick();
return difference(t1, oldt1);
}
-qint64 QTimestamp::elapsed() const
+qint64 QElapsedTimer::elapsed() const
{
return difference(getMillisecondFromTick(), t1);
}
-qint64 QTimestamp::msecsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
{
return difference(other.t1, t1);
}
-qint64 QTimestamp::secsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const
{
return msecsTo(other) / 1000;
}
-bool operator<(const QTimestamp &v1, const QTimestamp &v2)
+bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2)
{
return difference(v1.t1, v2.t1) < 0;
}
diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp
index 507c861..b8215f4 100644
--- a/src/corelib/tools/qtimestamp_unix.cpp
+++ b/src/corelib/tools/qtimestamp_unix.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qtimestamp.h"
+#include "qelapsedtimer.h"
#include "qpair.h"
#include <sys/time.h>
#include <time.h>
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
static qint64 fractionAdjustment()
{
- if (QTimestamp::isMonotonic()) {
+ if (QElapsedTimer::isMonotonic()) {
// the monotonic timer is measured in nanoseconds
// 1 ms = 1000000 ns
return 1000*1000ull;
@@ -66,7 +66,7 @@ static qint64 fractionAdjustment()
}
}
-bool QTimestamp::isMonotonic()
+bool QElapsedTimer::isMonotonic()
{
#if (_POSIX_MONOTONIC_CLOCK-0 > 0)
return true;
@@ -95,7 +95,7 @@ static inline QPair<long, long> do_gettime()
return qMakePair(ts.tv_sec, ts.tv_nsec);
#else
# if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED)
- if (QTimestamp::isMonotonic()) {
+ if (QElapsedTimer::isMonotonic()) {
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return qMakePair(ts.tv_sec, ts.tv_nsec);
@@ -116,20 +116,20 @@ timeval qt_gettime()
timeval tv;
tv.tv_sec = r.first;
tv.tv_usec = r.second;
- if (QTimestamp::isMonotonic())
+ if (QElapsedTimer::isMonotonic())
tv.tv_usec /= 1000;
return tv;
}
-void QTimestamp::start()
+void QElapsedTimer::start()
{
QPair<long, long> r = do_gettime();
t1 = r.first;
t2 = r.second;
}
-qint64 QTimestamp::restart()
+qint64 QElapsedTimer::restart()
{
QPair<long, long> r = do_gettime();
qint64 oldt1 = t1;
@@ -142,26 +142,26 @@ qint64 QTimestamp::restart()
return r.first * 1000 + r.second / fractionAdjustment();
}
-qint64 QTimestamp::elapsed() const
+qint64 QElapsedTimer::elapsed() const
{
- QTimestamp now;
+ QElapsedTimer now;
now.start();
return msecsTo(now);
}
-qint64 QTimestamp::msecsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
{
qint64 secs = other.t1 - t1;
qint64 fraction = other.t2 - t2;
return secs * 1000 + fraction / fractionAdjustment();
}
-qint64 QTimestamp::secsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const
{
return other.t1 - t1;
}
-bool operator<(const QTimestamp &v1, const QTimestamp &v2)
+bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2)
{
return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2);
}
diff --git a/src/corelib/tools/qtimestamp_win.cpp b/src/corelib/tools/qtimestamp_win.cpp
index 1aea5cf..e384dd8 100644
--- a/src/corelib/tools/qtimestamp_win.cpp
+++ b/src/corelib/tools/qtimestamp_win.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qtimestamp.h"
+#include "qelapsedtimer.h"
#include <windows.h>
typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void);
@@ -88,40 +88,40 @@ static qint64 difference(qint64 a, qint64 b)
return retval;
}
-bool QTimestamp::isMonotonic()
+bool QElapsedTimer::isMonotonic()
{
return true;
}
-void QTimestamp::start()
+void QElapsedTimer::start()
{
t1 = getTickCount();
t2 = 0;
}
-qint64 QTimestamp::restart()
+qint64 QElapsedTimer::restart()
{
qint64 oldt1 = t1;
t1 = getTickCount();
return difference(t1, oldt1);
}
-qint64 QTimestamp::elapsed() const
+qint64 QElapsedTimer::elapsed() const
{
return difference(getTickCount(), t1);
}
-qint64 QTimestamp::msecsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
{
return difference(other.t1, t1);
}
-qint64 QTimestamp::secsTo(const QTimestamp &other) const
+qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const
{
return msecsTo(other) / 1000;
}
-bool operator<(const QTimestamp &v1, const QTimestamp &v2)
+bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2)
{
return difference(v1.t1, v2.t1) < 0;
}
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index e1097c4..692fae9 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -42,7 +42,7 @@ HEADERS += \
tools/qstringmatcher.h \
tools/qtextboundaryfinder.h \
tools/qtimeline.h \
- tools/qtimestamp.h \
+ tools/qelapsedtimer.h \
tools/qunicodetables_p.h \
tools/qvarlengtharray.h \
tools/qvector.h \
@@ -77,16 +77,16 @@ SOURCES += \
tools/qstringlist.cpp \
tools/qtextboundaryfinder.cpp \
tools/qtimeline.cpp \
- tools/qtimestamp.cpp \
+ tools/qelapsedtimer.cpp \
tools/qvector.cpp \
tools/qvsnprintf.cpp
symbian:SOURCES+=tools/qlocale_symbian.cpp
-mac:SOURCES += tools/qtimestamp_mac.cpp
-else:unix:SOURCES += tools/qtimestamp_unix.cpp
-else:win32:SOURCES += tools/qtimestamp_win.cpp
-else:SOURCES += tools/qtimestamp_generic.cpp
+mac:SOURCES += tools/qelapsedtimer_mac.cpp
+else:unix:SOURCES += tools/qelapsedtimer_unix.cpp
+else:win32:SOURCES += tools/qelapsedtimer_win.cpp
+else:SOURCES += tools/qelapsedtimer_generic.cpp
#zlib support
contains(QT_CONFIG, zlib) {