From 71ee64f5a44dc310272b14fe6cd913b2e75672ed Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 21 Dec 2009 13:28:47 +0200 Subject: Edit focus should not be lost unless by explicit action Currently non-touch devices lose edit focus if window switch happens. I.e. in cases when screensaver activates, an incoming call occurs, a global notification is shown... With this fix, edit focus remain active, until user removes the focus explicitly. Task-number: 4792 Reviewed-by: axis --- src/gui/kernel/qapplication.cpp | 6 +++++- src/gui/text/qtextcontrol.cpp | 6 +++++- src/gui/widgets/qlineedit.cpp | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index bd13423..4165c95 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2096,7 +2096,11 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) if (prev) { #ifdef QT_KEYPAD_NAVIGATION if (QApplication::keypadNavigationEnabled()) { - if (prev->hasEditFocus() && reason != Qt::PopupFocusReason) + if (prev->hasEditFocus() && reason != Qt::PopupFocusReason +#ifdef Q_OS_SYMBIAN + && reason != Qt::ActiveWindowFocusReason +#endif + ) prev->setEditFocus(false); } #endif diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index f96f66b..f523226 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1938,7 +1938,11 @@ void QTextControlPrivate::focusEvent(QFocusEvent *e) emit q->updateRequest(q->selectionRect()); if (e->gotFocus()) { #ifdef QT_KEYPAD_NAVIGATION - if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && e->reason() == Qt::PopupFocusReason)) { + if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason +#ifdef Q_OS_SYMBIAN + || e->reason() == Qt::ActiveWindowFocusReason +#endif + ))) { #endif cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard); if (interactionFlags & Qt::TextEditable) { diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 15dcda2..573b2b5 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1761,7 +1761,11 @@ void QLineEdit::focusInEvent(QFocusEvent *e) d->clickCausedFocus = 1; } #ifdef QT_KEYPAD_NAVIGATION - if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)){ + if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && ( e->reason() == Qt::PopupFocusReason +#ifdef Q_OS_SYMBIAN + || e->reason() == Qt::ActiveWindowFocusReason +#endif + ))) { #endif d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); QStyleOptionFrameV2 opt; -- cgit v0.12 hanged, 284 insertions(+) create mode 100644 src/corelib/tools/qtimestamp.h create mode 100644 src/corelib/tools/qtimestamp_generic.cpp create mode 100644 tests/auto/qtimestamp/qtimestamp.pro create mode 100644 tests/auto/qtimestamp/tst_qtimestamp.cpp diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 6fdc855..75b5985 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -204,6 +204,7 @@ private: friend class QDateTime; friend class QDateTimePrivate; + friend class QTimestamp; #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/qtimestamp.h b/src/corelib/tools/qtimestamp.h new file mode 100644 index 0000000..f923cd4 --- /dev/null +++ b/src/corelib/tools/qtimestamp.h @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QTIMESTAMP_H +#define QTIMESTAMP_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QTimestamp +{ +public: + static bool isMonotonic(); + + void start(); + qint64 restart() + { + qint64 r = elapsed(); + start(); + return r; + } + + qint64 elapsed() const; + bool 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); + } + + qint64 msecsTo(const QTimestamp &other) const; + void addMSecs(int ms); + qint64 secsTo(const QTimestamp &other) const; + void addSecs(int secs); + + bool operator==(const QTimestamp &other) const + { return t1 == other.t1 && t2 == other.t2; } + bool operator!=(const QTimestamp &other) const + { return !(*this == other); } + + friend bool Q_CORE_EXPORT operator<(const QTimestamp &v1, const QTimestamp &v2); + friend qint64 operator-(const QTimestamp &v1, const QTimestamp &v2) + { return v2.msecsTo(v1); } + + friend QTimestamp &operator+=(QTimestamp &ts, qint64 ms) + { ts.addMSecs(ms); return ts; } + friend QTimestamp operator+(const QTimestamp &ts, qint64 ms) + { QTimestamp copy(ts); return copy += ms; } + friend QTimestamp &operator-=(QTimestamp &ts, qint64 ms) + { ts.addMSecs(-ms); return ts; } + friend QTimestamp operator-(const QTimestamp &ts, qint64 ms) + { QTimestamp copy(ts); return copy -= ms; } + +private: + qint64 t1; + qint64 t2; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTIMESTAMP_H diff --git a/src/corelib/tools/qtimestamp_generic.cpp b/src/corelib/tools/qtimestamp_generic.cpp new file mode 100644 index 0000000..18c5026 --- /dev/null +++ b/src/corelib/tools/qtimestamp_generic.cpp @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** 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 "qtimestamp.h" +#include "qdatetime.h" + +QT_BEGIN_NAMESPACE + +bool QTimestamp::isMonotonic() +{ + return false; +} + +void QTimestamp::start() +{ + QTime t = QTime::currentTime(); + t1 = t.mds; + t2 = 0; +} + +qint64 QTimestamp::elapsed() const +{ + QTime t = QTime::currentTime(); + return t.mds - t1; +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + qint64 diff = other.t1 - t1; + if (diff < 0) // passed midnight + diff += 86400 * 1000; + return diff; +} + +void QTimestamp::addMSecs(int ms) +{ + t1 += ms; +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return msecsTo(other) / 1000; +} + +void QTimestamp::addSecs(int secs) +{ + t1 += secs * 1000; +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return v1.t1 < v2.t1; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 6d64915..49f2f16 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -42,6 +42,7 @@ HEADERS += \ tools/qstringmatcher.h \ tools/qtextboundaryfinder.h \ tools/qtimeline.h \ + tools/qtimestamp.h \ tools/qunicodetables_p.h \ tools/qvarlengtharray.h \ tools/qvector.h \ @@ -81,6 +82,8 @@ SOURCES += \ symbian:SOURCES+=tools/qlocale_symbian.cpp +unix:SOURCES += tools/qtimestamp_generic.cpp + #zlib support contains(QT_CONFIG, zlib) { wince*: DEFINES += NO_ERRNO_H diff --git a/tests/auto/qtimestamp/qtimestamp.pro b/tests/auto/qtimestamp/qtimestamp.pro new file mode 100644 index 0000000..3a06390 --- /dev/null +++ b/tests/auto/qtimestamp/qtimestamp.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +QT -= gui + +SOURCES += tst_qtimestamp.cpp +wince* { + DEFINES += SRCDIR=\\\"\\\" +} else:symbian { + # do not define SRCDIR at all + TARGET.EPOCHEAPSIZE = 0x100000 0x3000000 +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + diff --git a/tests/auto/qtimestamp/tst_qtimestamp.cpp b/tests/auto/qtimestamp/tst_qtimestamp.cpp new file mode 100644 index 0000000..5a0b230 --- /dev/null +++ b/tests/auto/qtimestamp/tst_qtimestamp.cpp @@ -0,0 +1,68 @@ +#include +#include +#include +#include + +class tst_QTimestamp : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void basics(); + void elapsed(); +}; + +void tst_QTimestamp::basics() +{ + QTimestamp t1; + t1.start(); + + QCOMPARE(t1, t1); + QVERIFY(!(t1 != t1)); + QVERIFY(!(t1 < t1)); + QCOMPARE(t1.msecsTo(t1), qint64(0)); + QCOMPARE(t1.secsTo(t1), qint64(0)); + QCOMPARE(t1 + 0, t1); + QCOMPARE(t1 - 0, t1); + + QTimestamp t2 = t1; + t2 += 1000; // so we can use secsTo + + QVERIFY(t1 != t2); + QVERIFY(!(t1 == t2)); + QVERIFY(t1 < t2); + QVERIFY(!(t2 < t1)); + QCOMPARE(t1.msecsTo(t2), qint64(1000)); + QCOMPARE(t1.secsTo(t2), qint64(1)); + QCOMPARE(t2 - t1, qint64(1000)); + QCOMPARE(t1 - t2, qint64(-1000)); +} + +void tst_QTimestamp::elapsed() +{ + QTimestamp t1; + t1.start(); + + QTest::qWait(100); + QTimestamp t2; + t2.start(); + + QVERIFY(t1 != t2); + QVERIFY(!(t1 == t2)); + QVERIFY(t1 < t2); + QVERIFY(t1.msecsTo(t2) > 0); + // don't check: t1.secsTo(t2) + QVERIFY(t1 - t2 < 0); + + QVERIFY(t1.elapsed() > 0); + QVERIFY(t1.hasExpired(50)); + QVERIFY(!t1.hasExpired(500)); + QVERIFY(!t2.hasExpired(0)); + + QVERIFY(!t1.hasExpired(-1)); + QVERIFY(!t2.hasExpired(-1)); +} + +QTEST_MAIN(tst_QTimestamp); + +#include "tst_qtimestamp.moc" -- cgit v0.12 From e33a545fc76ad99db39680433b151815175f8b76 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 12:21:53 +0100 Subject: Add the Mac implementation of QTimestamp. Task-number: QT-2965 --- src/corelib/tools/qtimestamp_mac.cpp | 109 +++++++++++++++++++++++++++++++++++ src/corelib/tools/tools.pri | 3 +- 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 src/corelib/tools/qtimestamp_mac.cpp diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp new file mode 100644 index 0000000..bdc91d1 --- /dev/null +++ b/src/corelib/tools/qtimestamp_mac.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** 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 "qtimestamp.h" +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +bool QTimestamp::isMonotonic() +{ + return true; +} + +static mach_timebase_info_data_t info = {0,0}; +static qint64 absoluteToMSecs(qint64 cpuTime) +{ + if (info.denom == 0) + mach_timebase_info(&info); + qint64 nsecs = cpuTime * info.numer / info.denom; + return nsecs / (1000*1000ull); +} + +static qint64 msecsToAbsolute(qint64 ms) +{ + if (info.denom == 0) + mach_timebase_info(&info); + qint64 nsecs = ms * 1000000ull; + return nsecs * info.denom / info.numer; +} + +void QTimestamp::start() +{ + t1 = mach_absolute_time(); + t2 = 0; +} + +qint64 QTimestamp::elapsed() const +{ + uint64_t cpu_time = mach_absolute_time(); + return absoluteToMSecs(cpu_time - t1); +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + return absoluteToMSecs(other.t1 - t1); +} + +void QTimestamp::addMSecs(int ms) +{ + t1 += msecsToAbsolute(ms); +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return msecsTo(other) / 1000; +} + +void QTimestamp::addSecs(int secs) +{ + t1 += secs * 1000; +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return v1.t1 < v2.t1; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 49f2f16..3599cc7 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -82,7 +82,8 @@ SOURCES += \ symbian:SOURCES+=tools/qlocale_symbian.cpp -unix:SOURCES += tools/qtimestamp_generic.cpp +mac:SOURCES += tools/qtimestamp_mac.cpp +else:SOURCES += tools/qtimestamp_generic.cpp #zlib support contains(QT_CONFIG, zlib) { -- cgit v0.12 From 495581a1278f534e855d6122cdcb719c1df6d40b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 12:50:52 +0100 Subject: Add the non-Mac Unix implementation of QTimestamp. Task-number: QT-2965 --- src/corelib/tools/qtimestamp_unix.cpp | 149 ++++++++++++++++++++++++++++++++++ src/corelib/tools/tools.pri | 1 + 2 files changed, 150 insertions(+) create mode 100644 src/corelib/tools/qtimestamp_unix.cpp diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp new file mode 100644 index 0000000..b82259f --- /dev/null +++ b/src/corelib/tools/qtimestamp_unix.cpp @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** 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 "qtimestamp.h" +#include +#include +#include + +#if !defined(QT_NO_CLOCK_MONOTONIC) +# if defined(QT_BOOTSTRAPPED) +# define QT_NO_CLOCK_MONOTONIC +# endif +#endif + +QT_BEGIN_NAMESPACE + +bool QTimestamp::isMonotonic() +{ +#if (_POSIX_MONOTONIC_CLOCK-0 > 0) + return true; +#else + static int returnValue = 0; + + if (returnValue == 0) { +# if (_POSIX_MONOTONIC_CLOCK-0 < 0) + returnValue = -1; +# elif (_POSIX_MONOTONIC_CLOCK == 0) + // detect if the system support monotonic timers + long x = sysconf(_SC_MONOTONIC_CLOCK); + returnValue = (x >= 200112L) ? 1 : -1; +# endif + } + + return returnValue != -1; +#endif +} + +static qint64 fractionAdjustment() +{ + if (QTimestamp::isMonotonic()) { + // the monotonic timer is measured in nanoseconds + // 1 ms = 1000000 ns + return 1000*1000ull; + } else { + // gettimeofday is measured in microseconds + // 1 ms = 1000 us + return 1000; + } +} + +void QTimestamp::start() +{ +#if (_POSIX_MONOTONIC_CLOCK-0 > 0) + timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + t1 = ts.tv_sec; + t2 = ts.tv_nsec; +#else +# if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) + if (isMonotonic()) { + timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + t1 = ts.tv_sec; + t2 = ts.tv_nsec; + return; + } +# endif + // use gettimeofday + timeval tv; + ::gettimeofday(&tv, 0); + t1 = tv.tv_sec; + t2 = tv.tv_usec; +#endif +} + +qint64 QTimestamp::elapsed() const +{ + QTimestamp now; + now.start(); + return msecsTo(now); +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + qint64 secs = other.t1 - t1; + qint64 fraction = other.t2 - t2; + return secs * 1000 + fraction / fractionAdjustment(); +} + +void QTimestamp::addMSecs(int ms) +{ + t1 += ms / 1000; + t2 += ms % 1000 * fractionAdjustment(); +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return other.t1 - t1; +} + +void QTimestamp::addSecs(int secs) +{ + t1 += secs; +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2); +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 3599cc7..b8a0ae1 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -83,6 +83,7 @@ SOURCES += \ symbian:SOURCES+=tools/qlocale_symbian.cpp mac:SOURCES += tools/qtimestamp_mac.cpp +else:unix:SOURCES += tools/qtimestamp_unix.cpp else:SOURCES += tools/qtimestamp_generic.cpp #zlib support -- cgit v0.12 From 3e20aa117f4867aa40e03103fcb4e1a54b42dd1c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 13:05:47 +0100 Subject: Add the Windows implementation of QTimestamp Task-number: QT-2965 --- src/corelib/tools/qtimestamp_win.cpp | 120 +++++++++++++++++++++++++++++++++++ src/corelib/tools/tools.pri | 1 + 2 files changed, 121 insertions(+) create mode 100644 src/corelib/tools/qtimestamp_win.cpp diff --git a/src/corelib/tools/qtimestamp_win.cpp b/src/corelib/tools/qtimestamp_win.cpp new file mode 100644 index 0000000..99faebd --- /dev/null +++ b/src/corelib/tools/qtimestamp_win.cpp @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** 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 "qtimestamp.h" +#include + +typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void); +static PtrGetTickCount64 ptrGetTickCount64 = 0; + +QT_BEGIN_NAMESPACE + +static void resolveLibs() +{ + static bool done = false; + if (done) + return; + + // try to get GetTickCount64 from the system + HMODULE kernel32 = GetModuleHandleW(L"kernel32"); + if (!kernel32) + return; + +#if defined(Q_OS_WINCE) + // does this function exist on WinCE, or will ever exist? + ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, L"GetTickCount64"); +#else + ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, "GetTickCount64"); +#endif + + done = true; +} + +static quint64 getTickCount() +{ + resolveLibs(); + if (ptrGetTickCount64) + return ptrGetTickCount64(); + return GetTickCount(); +} + +bool QTimestamp::isMonotonic() +{ + return true; +} + +void QTimestamp::start() +{ + t1 = getTickCount(); + t2 = 0; +} + +qint64 QTimestamp::elapsed() const +{ + return getTickCount() - t1; +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + return other.t1 - t1; +} + +void QTimestamp::addMSecs(int ms) +{ + t1 += ms; +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return msecsTo(other) / 1000; +} + +void QTimestamp::addSecs(int secs) +{ + t1 += secs * 1000; +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return v1.t1 < v2.t1; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index b8a0ae1..863f86e 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -84,6 +84,7 @@ 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 #zlib support -- cgit v0.12 From ca0def08d1ec2575546f7bfa3759f24288ba8e2a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Feb 2010 14:10:05 +0100 Subject: Add the Symbian version of QTimestamp. This code is disabled --- src/corelib/tools/qtimestamp_symbian.cpp | 117 +++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 src/corelib/tools/qtimestamp_symbian.cpp diff --git a/src/corelib/tools/qtimestamp_symbian.cpp b/src/corelib/tools/qtimestamp_symbian.cpp new file mode 100644 index 0000000..e78597c --- /dev/null +++ b/src/corelib/tools/qtimestamp_symbian.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** 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 "qtimestamp.h" +#include + +QT_BEGIN_NAMESPACE + +// return quint64 to avoid sign-extension +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 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 QTimestamp::isMonotonic() +{ + return true; +} + +void QTimestamp::start() +{ + t1 = getMillisecondFromTick(); + t2 = 0; +} + +qint64 QTimestamp::restart() +{ + qint64 oldt1 = t1; + t1 = getMillisecondFromTick(); + return difference(t1, oldt1); +} + +qint64 QTimestamp::elapsed() const +{ + return difference(getMillisecondFromTick(), t1); +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + return difference(other.t1, t1); +} + +void QTimestamp::addMSecs(int ms) +{ + // simulate a 32-bit rollover + t1 = quint32(t1 + ms); +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return msecsTo(other) / 1000; +} + +void QTimestamp::addSecs(int secs) +{ + addMSecs(secs * 1000); +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return difference(v1.t1, v2.t1) < 0; +} + +QT_END_NAMESPACE -- cgit v0.12 From 49d949b644b94fbd6c1946ffddcc1b8675ffa9ef Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 13:56:46 +0100 Subject: Make qcore_unix.cpp share code with QTimestamp --- src/corelib/kernel/qcore_unix.cpp | 65 +--------------------------- src/corelib/kernel/qcore_unix_p.h | 4 +- src/corelib/kernel/qeventdispatcher_unix.cpp | 9 ++-- src/corelib/tools/qtimestamp_mac.cpp | 25 ++++++++--- src/corelib/tools/qtimestamp_unix.cpp | 62 ++++++++++++++++---------- 5 files changed, 68 insertions(+), 97 deletions(-) diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 0fd965b..9146923 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qcore_unix_p.h" +#include "qtimestamp.h" #ifndef Q_OS_VXWORKS # if !defined(Q_OS_HPUX) || defined(__ia64) @@ -56,74 +57,12 @@ #include #endif -#if !defined(QT_NO_CLOCK_MONOTONIC) -# if defined(QT_BOOTSTRAPPED) -# define QT_NO_CLOCK_MONOTONIC -# endif -#endif - QT_BEGIN_NAMESPACE -bool qt_gettime_is_monotonic() -{ -#if (_POSIX_MONOTONIC_CLOCK-0 > 0) || defined(Q_OS_MAC) - return true; -#else - static int returnValue = 0; - - if (returnValue == 0) { -# if (_POSIX_MONOTONIC_CLOCK-0 < 0) - returnValue = -1; -# elif (_POSIX_MONOTONIC_CLOCK == 0) - // detect if the system support monotonic timers - long x = sysconf(_SC_MONOTONIC_CLOCK); - returnValue = (x >= 200112L) ? 1 : -1; -# endif - } - - return returnValue != -1; -#endif -} - -timeval qt_gettime() -{ - timeval tv; -#if defined(Q_OS_MAC) - static mach_timebase_info_data_t info = {0,0}; - if (info.denom == 0) - mach_timebase_info(&info); - - uint64_t cpu_time = mach_absolute_time(); - uint64_t nsecs = cpu_time * (info.numer / info.denom); - tv.tv_sec = nsecs / 1000000000ull; - tv.tv_usec = (nsecs / 1000) - (tv.tv_sec * 1000000); - return tv; -#elif (_POSIX_MONOTONIC_CLOCK-0 > 0) - timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; - return tv; -#else -# if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) - if (qt_gettime_is_monotonic()) { - timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; - return tv; - } -# endif - // use gettimeofday - ::gettimeofday(&tv, 0); - return tv; -#endif -} - static inline bool time_update(struct timeval *tv, const struct timeval &start, const struct timeval &timeout) { - if (!qt_gettime_is_monotonic()) { + if (!QTimestamp::isMonotonic()) { // we cannot recalculate the timeout without a monotonic clock as the time may have changed return false; } diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 297b25d..59d66f7 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -314,8 +314,8 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) # define _POSIX_MONOTONIC_CLOCK -1 #endif -bool qt_gettime_is_monotonic(); -timeval qt_gettime(); +timeval qt_gettime(); // in qtimestamp_mac.cpp or qtimestamp_unix.cpp + Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, const struct timeval *tv); diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index a141887..7a671d1 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -45,6 +45,7 @@ #include "qpair.h" #include "qsocketnotifier.h" #include "qthread.h" +#include "qtimestamp.h" #include "qeventdispatcher_unix_p.h" #include @@ -311,12 +312,10 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, QTimerInfoList::QTimerInfoList() { - currentTime = qt_gettime(); - #if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) - if (!qt_gettime_is_monotonic()) { + if (!QTimestamp::isMonotonic()) { // not using monotonic timers, initialize the timeChanged() machinery - previousTime = currentTime; + previousTime = qt_gettime(); tms unused; previousTicks = times(&unused); @@ -393,7 +392,7 @@ bool QTimerInfoList::timeChanged(timeval *delta) void QTimerInfoList::repairTimersIfNeeded() { - if (qt_gettime_is_monotonic()) + if (QTimestamp::isMonotonic()) return; timeval delta; if (timeChanged(&delta)) diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp index bdc91d1..e1a7d79 100644 --- a/src/corelib/tools/qtimestamp_mac.cpp +++ b/src/corelib/tools/qtimestamp_mac.cpp @@ -53,20 +53,35 @@ bool QTimestamp::isMonotonic() } static mach_timebase_info_data_t info = {0,0}; -static qint64 absoluteToMSecs(qint64 cpuTime) +static qint64 absoluteToNSecs(qint64 cpuTime) { if (info.denom == 0) mach_timebase_info(&info); qint64 nsecs = cpuTime * info.numer / info.denom; - return nsecs / (1000*1000ull); + return nsecs; +} + +static qint64 absoluteToMSecs(qint64 cpuTime) +{ + return absoluteToNSecs(cpuTime) / 1000000; } static qint64 msecsToAbsolute(qint64 ms) { if (info.denom == 0) mach_timebase_info(&info); - qint64 nsecs = ms * 1000000ull; - return nsecs * info.denom / info.numer; + return ms * 1000000 * info.denom / info.numer; +} + +timeval qt_gettime() +{ + timeval tv; + + uint64_t cpu_time = mach_absolute_time(); + uint64_t nsecs = absoluteToNSecs(cpu_time); + tv.tv_sec = nsecs / 1000000000ull; + tv.tv_usec = (nsecs / 1000) - (tv.tv_sec * 1000000); + return tv; } void QTimestamp::start() @@ -98,7 +113,7 @@ qint64 QTimestamp::secsTo(const QTimestamp &other) const void QTimestamp::addSecs(int secs) { - t1 += secs * 1000; + t1 += msecsToAbsolute(secs * 1000); } bool operator<(const QTimestamp &v1, const QTimestamp &v2) diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp index b82259f..dbf49c1 100644 --- a/src/corelib/tools/qtimestamp_unix.cpp +++ b/src/corelib/tools/qtimestamp_unix.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qtimestamp.h" +#include "qpair.h" #include #include #include @@ -52,6 +53,19 @@ QT_BEGIN_NAMESPACE +static qint64 fractionAdjustment() +{ + if (QTimestamp::isMonotonic()) { + // the monotonic timer is measured in nanoseconds + // 1 ms = 1000000 ns + return 1000*1000ull; + } else { + // gettimeofday is measured in microseconds + // 1 ms = 1000 us + return 1000; + } +} + bool QTimestamp::isMonotonic() { #if (_POSIX_MONOTONIC_CLOCK-0 > 0) @@ -73,44 +87,48 @@ bool QTimestamp::isMonotonic() #endif } -static qint64 fractionAdjustment() -{ - if (QTimestamp::isMonotonic()) { - // the monotonic timer is measured in nanoseconds - // 1 ms = 1000000 ns - return 1000*1000ull; - } else { - // gettimeofday is measured in microseconds - // 1 ms = 1000 us - return 1000; - } -} - -void QTimestamp::start() +static inline QPair do_gettime() { #if (_POSIX_MONOTONIC_CLOCK-0 > 0) timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - t1 = ts.tv_sec; - t2 = ts.tv_nsec; + return qMakePair(ts.tv_sec, ts.tv_nsec); #else # if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) - if (isMonotonic()) { + if (QTimestamp::isMonotonic()) { timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - t1 = ts.tv_sec; - t2 = ts.tv_nsec; - return; + return qMakePair(ts.tv_sec, ts.tv_nsec); } # endif // use gettimeofday timeval tv; ::gettimeofday(&tv, 0); - t1 = tv.tv_sec; - t2 = tv.tv_usec; + return qMakePair(tv.tv_sec, tv.tv_usec); #endif } +// used in qcore_unix.cpp and qeventdispatcher_unix.cpp +timeval qt_gettime() +{ + QPair r = do_gettime(); + + timeval tv; + tv.tv_sec = r.first; + tv.tv_usec = r.second; + if (QTimestamp::isMonotonic()) + tv.tv_usec /= 1000; + + return tv; +} + +void QTimestamp::start() +{ + QPair r = do_gettime(); + t1 = r.first; + t2 = r.second; +} + qint64 QTimestamp::elapsed() const { QTimestamp now; -- cgit v0.12 From 8c9446cd2058fde086df92f6b7d97e4770cf8dc6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 19:47:10 +0100 Subject: Add a qtimestamp.cpp with some common functions. Had to add invalidate() and isValid() functions because that's what QUnifiedTimer expects (QAbstractAnimation). Also move restart() to each implementation for efficiency. Task-number: QT-2965 --- src/corelib/tools/qtimestamp.cpp | 65 ++++++++++++++++++++++++++++++++ src/corelib/tools/qtimestamp.h | 16 ++------ src/corelib/tools/qtimestamp_generic.cpp | 8 ++++ src/corelib/tools/qtimestamp_mac.cpp | 8 ++++ src/corelib/tools/qtimestamp_unix.cpp | 13 +++++++ src/corelib/tools/qtimestamp_win.cpp | 7 ++++ src/corelib/tools/tools.pri | 1 + tests/auto/qtimestamp/tst_qtimestamp.cpp | 34 +++++++++++++++-- 8 files changed, 136 insertions(+), 16 deletions(-) create mode 100644 src/corelib/tools/qtimestamp.cpp diff --git a/src/corelib/tools/qtimestamp.cpp b/src/corelib/tools/qtimestamp.cpp new file mode 100644 index 0000000..b861099 --- /dev/null +++ b/src/corelib/tools/qtimestamp.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 "qtimestamp.h" + +QT_BEGIN_NAMESPACE + +static const qint64 invalidData = Q_INT64_C(0x8000000000000000); + +void QTimestamp::invalidate() +{ + t1 = t2 = invalidData; +} + +bool QTimestamp::isValid() const +{ + return t1 != invalidData && t2 != invalidData; +} + +bool QTimestamp::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 diff --git a/src/corelib/tools/qtimestamp.h b/src/corelib/tools/qtimestamp.h index f923cd4..1e913f0 100644 --- a/src/corelib/tools/qtimestamp.h +++ b/src/corelib/tools/qtimestamp.h @@ -56,20 +56,12 @@ public: static bool isMonotonic(); void start(); - qint64 restart() - { - qint64 r = elapsed(); - start(); - return r; - } + qint64 restart(); + void invalidate(); + bool isValid() const; qint64 elapsed() const; - bool 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); - } + bool hasExpired(qint64 timeout) const; qint64 msecsTo(const QTimestamp &other) const; void addMSecs(int ms); diff --git a/src/corelib/tools/qtimestamp_generic.cpp b/src/corelib/tools/qtimestamp_generic.cpp index 18c5026..9930932 100644 --- a/src/corelib/tools/qtimestamp_generic.cpp +++ b/src/corelib/tools/qtimestamp_generic.cpp @@ -56,6 +56,14 @@ void QTimestamp::start() t2 = 0; } +qint64 QTimestamp::restart() +{ + QTime t = QTime::currentTime(); + qint64 old = t1; + t1 = t.mds; + return t1 - old; +} + qint64 QTimestamp::elapsed() const { QTime t = QTime::currentTime(); diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp index e1a7d79..a80e7ee 100644 --- a/src/corelib/tools/qtimestamp_mac.cpp +++ b/src/corelib/tools/qtimestamp_mac.cpp @@ -90,6 +90,14 @@ void QTimestamp::start() t2 = 0; } +qint64 QTimestamp::restart() +{ + qint64 old = t1; + t1 = mach_absolute_time(); + + return absoluteToMSecs(t1 - old); +} + qint64 QTimestamp::elapsed() const { uint64_t cpu_time = mach_absolute_time(); diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp index dbf49c1..75371e7 100644 --- a/src/corelib/tools/qtimestamp_unix.cpp +++ b/src/corelib/tools/qtimestamp_unix.cpp @@ -129,6 +129,19 @@ void QTimestamp::start() t2 = r.second; } +qint64 QTimestamp::restart() +{ + QPair r = do_gettime(); + qint64 oldt1 = t1; + qint64 oldt2 = t2; + t1 = r.first; + t2 = r.second; + + r.first -= oldt1; + r.second -= oldt2; + return r.first * 1000 + r.second / fractionAdjustment(); +} + qint64 QTimestamp::elapsed() const { QTimestamp now; diff --git a/src/corelib/tools/qtimestamp_win.cpp b/src/corelib/tools/qtimestamp_win.cpp index 99faebd..72d38d0 100644 --- a/src/corelib/tools/qtimestamp_win.cpp +++ b/src/corelib/tools/qtimestamp_win.cpp @@ -87,6 +87,13 @@ void QTimestamp::start() t2 = 0; } +qint64 QTimestamp::restart() +{ + qint64 oldt1 = t1; + t1 = getTickCount(); + return t1 - oldt1; +} + qint64 QTimestamp::elapsed() const { return getTickCount() - t1; diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 863f86e..e1097c4 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -77,6 +77,7 @@ SOURCES += \ tools/qstringlist.cpp \ tools/qtextboundaryfinder.cpp \ tools/qtimeline.cpp \ + tools/qtimestamp.cpp \ tools/qvector.cpp \ tools/qvsnprintf.cpp diff --git a/tests/auto/qtimestamp/tst_qtimestamp.cpp b/tests/auto/qtimestamp/tst_qtimestamp.cpp index 5a0b230..ab1e959 100644 --- a/tests/auto/qtimestamp/tst_qtimestamp.cpp +++ b/tests/auto/qtimestamp/tst_qtimestamp.cpp @@ -3,15 +3,32 @@ #include