diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2019-05-06 18:19:06 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-05-24 16:43:39 +0200 |
commit | ed99a591a83a399458f12341d0a1c0b3152f247a (patch) | |
tree | 93aca7c5042df0549d475f5ccace817c3439877b /src | |
parent | d2090b764aa23f9b50215aa5d276583117c328d3 (diff) |
Deprecate use of QTime as a timer
QElapsedTimer does the job better and without the DST kludges.
Change-Id: Ic4a566f695648cbe069a21ea8d3e84562b665a3c
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 16 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.h | 8 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 0f8c8629a8..9220d210f1 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -1686,12 +1686,10 @@ bool QDate::isLeapYear(int y) \brief The QTime class provides clock time functions. - A QTime object contains a clock time, which it can express as the - numbers of hours, minutes, seconds, and milliseconds since - midnight. It can read the current time from the system clock and - measure a span of elapsed time. It provides functions for - comparing times and for manipulating a time by adding a number of - milliseconds. + A QTime object contains a clock time, which it can express as the numbers of + hours, minutes, seconds, and milliseconds since midnight. It provides + functions for comparing times and for manipulating a time by adding a number + of milliseconds. QTime uses the 24-hour clock format; it has no concept of AM/PM. Unlike QDateTime, QTime knows nothing about time zones or @@ -1718,9 +1716,6 @@ bool QDate::isLeapYear(int y) objects; an earlier time is considered smaller than a later one; if A.msecsTo(B) is positive, then A < B. - QTime can be used to measure a span of elapsed time using the - start(), restart(), and elapsed() functions. - \sa QDate, QDateTime */ @@ -2364,7 +2359,7 @@ bool QTime::isValid(int h, int m, int s, int ms) return (uint)h < 24 && (uint)m < 60 && (uint)s < 60 && (uint)ms < 1000; } - +#if QT_DEPRECATED_SINCE(5, 14) // ### Qt 6: remove /*! Sets this time to the current time. This is practical for timing: @@ -2433,6 +2428,7 @@ int QTime::elapsed() const n += 86400 * 1000; return n; } +#endif // Use QElapsedTimer instead ! /***************************************************************************** QDateTime static helper functions diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 1ff187a9bd..3e3b953b52 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -206,9 +206,11 @@ public: #endif static bool isValid(int h, int m, int s, int ms = 0); - void start(); - int restart(); - int elapsed() const; +#if QT_DEPRECATED_SINCE(5, 14) // ### Qt 6: remove + QT_DEPRECATED_X("Use QElapsedTimer instead") void start(); + QT_DEPRECATED_X("Use QElapsedTimer instead") int restart(); + QT_DEPRECATED_X("Use QElapsedTimer instead") int elapsed() const; +#endif private: enum TimeFlag { NullTime = -1 }; Q_DECL_CONSTEXPR inline int ds() const { return mds == -1 ? 0 : mds; } |