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>
This commit is contained in:
Edward Welbourne 2019-05-06 18:19:06 +02:00
parent d2090b764a
commit ed99a591a8
2 changed files with 11 additions and 13 deletions

View File

@ -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

View File

@ -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; }