summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qelapsedtimer.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-02-26 14:02:56 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-03-17 10:54:19 (GMT)
commit7f3c9feaaf67ce7e89cd2f9df2155c61a58acaed (patch)
tree226e3222506672a358318955906b859c9ca6b59c /src/corelib/tools/qelapsedtimer.cpp
parent21983be486af0d252b8d393ed36b15becb3c8824 (diff)
downloadQt-7f3c9feaaf67ce7e89cd2f9df2155c61a58acaed.zip
Qt-7f3c9feaaf67ce7e89cd2f9df2155c61a58acaed.tar.gz
Qt-7f3c9feaaf67ce7e89cd2f9df2155c61a58acaed.tar.bz2
Rename the files too
Diffstat (limited to 'src/corelib/tools/qelapsedtimer.cpp')
-rw-r--r--src/corelib/tools/qelapsedtimer.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/tools/qelapsedtimer.cpp
new file mode 100644
index 0000000..220b108
--- /dev/null
+++ b/src/corelib/tools/qelapsedtimer.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qelapsedtimer.h"
+
+QT_BEGIN_NAMESPACE
+
+static const qint64 invalidData = Q_INT64_C(0x8000000000000000);
+
+void QElapsedTimer::invalidate()
+{
+ t1 = t2 = invalidData;
+}
+
+bool QElapsedTimer::isValid() const
+{
+ return t1 != invalidData && t2 != invalidData;
+}
+
+bool QElapsedTimer::hasExpired(qint64 timeout) const
+{
+ // if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be
+ // considered as never expired
+ return quint64(elapsed()) > quint64(timeout);
+}
+
+QT_END_NAMESPACE