Obsolete Members for QTime

The following members of class QTime are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

Public Functions

(obsolete) int elapsed() const
(obsolete) void start()

Member Function Documentation

int QTime::elapsed() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns the number of milliseconds that have elapsed since the last time start() or restart() was called.

Note that the counter wraps to zero 24 hours after the last call to start() or restart.

Note that the accuracy depends on the accuracy of the underlying operating system; not all systems provide 1-millisecond accuracy.

Warning: If the system's clock setting has been changed since the last time start() or restart() was called, the result is undefined. This can happen when daylight-saving time is turned on or off.

See also start() and restart().

void QTime::start()

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Sets this time to the current time. This is practical for timing:

QTime t;
t.start();
some_lengthy_task();
qDebug("Time elapsed: %d ms", t.elapsed());

See also restart(), elapsed(), and currentTime().

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.