diff options
Diffstat (limited to 'src/corelib/kernel/qelapsedtimer.cpp')
-rw-r--r-- | src/corelib/kernel/qelapsedtimer.cpp | 94 |
1 files changed, 31 insertions, 63 deletions
diff --git a/src/corelib/kernel/qelapsedtimer.cpp b/src/corelib/kernel/qelapsedtimer.cpp index 9d96cfc34a..230bcac33f 100644 --- a/src/corelib/kernel/qelapsedtimer.cpp +++ b/src/corelib/kernel/qelapsedtimer.cpp @@ -1,12 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:COMM$ -** +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -15,25 +14,26 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** -** $QT_END_LICENSE$ -** -** -** -** -** -** -** -** -** -** -** -** -** -** -** -** -** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -111,18 +111,6 @@ QT_BEGIN_NAMESPACE that the clock used is the same as QElapsedTimer (see QElapsedTimer::clockType()). - \section2 32-bit overflows - - Some of the clocks used by QElapsedTimer have a limited range and may - overflow after hitting the upper limit (usually 32-bit). QElapsedTimer - deals with this overflow issue and presents a consistent timing. However, - when extracting the time since reference from QElapsedTimer, two - different processes in the same machine may have different understanding - of how much time has actually elapsed. - - The information on which clocks types may overflow and how to remedy that - issue is documented along with the clock types. - \sa QTime, QTimer, QDeadlineTimer */ @@ -138,10 +126,13 @@ QT_BEGIN_NAMESPACE used. \value SystemTime The human-readable system time. This clock is not monotonic. - \value MonotonicClock The system's monotonic clock, usually found in Unix systems. This clock is monotonic and does not overflow. - \value TickCounter The system's tick counter, used on Windows systems. This clock may overflow. - \value MachAbsoluteTime The Mach kernel's absolute time (\macos and iOS). This clock is monotonic and does not overflow. - \value PerformanceCounter The high-resolution performance counter provided by Windows. This clock is monotonic and does not overflow. + \value MonotonicClock The system's monotonic clock, usually found in Unix systems. + This clock is monotonic. + \value TickCounter Not used anymore. + \value MachAbsoluteTime The Mach kernel's absolute time (\macos and iOS). + This clock is monotonic. + \value PerformanceCounter The performance counter provided by Windows. + This clock is monotonic. \section2 SystemTime @@ -159,26 +150,6 @@ QT_BEGIN_NAMESPACE arbitrary point in the past. This clock type is used on Unix systems which support POSIX monotonic clocks (\tt{_POSIX_MONOTONIC_CLOCK}). - This clock does not overflow. - - \section2 TickCounter - - The tick counter clock type is based on the system's or the processor's - tick counter, multiplied by the duration of a tick. This clock type is - used on Windows platforms. If the high-precision performance - counter is available on Windows, the \tt{PerformanceCounter} clock type - is used instead. - - The TickCounter clock type is the only clock type that may overflow. - Windows Vista and Windows Server 2008 support the extended 64-bit tick - counter, which allows avoiding the overflow. - - On Windows systems, the clock overflows after 2^32 milliseconds, which - corresponds to roughly 49.7 days. This means two processes' reckoning of - the time since the reference may be different by multiples of 2^32 - milliseconds. When comparing such values, it's recommended that the high - 32 bits of the millisecond count be masked off. - \section2 MachAbsoluteTime This clock type is based on the absolute time presented by Mach kernels, @@ -187,17 +158,14 @@ QT_BEGIN_NAMESPACE a POSIX monotonic clock with values differing from the Mach absolute time. - This clock is monotonic and does not overflow. + This clock is monotonic. \section2 PerformanceCounter This clock uses the Windows functions \tt{QueryPerformanceCounter} and - \tt{QueryPerformanceFrequency} to access the system's high-precision - performance counter. Since this counter may not be available on all - systems, QElapsedTimer will fall back to the \tt{TickCounter} clock - automatically, if this clock cannot be used. + \tt{QueryPerformanceFrequency} to access the system's performance counter. - This clock is monotonic and does not overflow. + This clock is monotonic. \sa clockType(), isMonotonic() */ |