PDA

View Full Version : Alternative to QElapsedTimer in old Qt version



Asperamanca
17th March 2011, 09:31
Hi,

I would like to run some simple benchmarks on an embedded device with an architecture that does not support valgrind.
For my purposes, something like the the QElapsedTimer would be sufficient, unfortunately, the Qt version on the device is too old, and cannot be upgraded easily.

What would be a viable alternative to using QElapsedTimer that would work with Qt 4.6.3 ?

Thanks!

high_flyer
17th March 2011, 09:36
You could use QTime with msecsTo().

wysota
17th March 2011, 09:37
Or with elapsed()

safrm
27th February 2012, 10:08
the right pattern seems to be:

#if (QT_VERSION < QT_VERSION_CHECK(4, 7, 0))
# include <QTime>
typedef QTime QElapsedTimer;
#else
# include <QElapsedTimer>
#endif