3

As the title says: I have this snippet:

QTimer timerdata;

I can start the timer by calling timerdata.start(5); However, I am not getting 5 msec...I know that in Qt 5.x there are three levels of precision for timers:

  • Qt::PreciseTimer: About 1 ms resolution on Windows
  • Qt::CoarseTimer (default): About 15 ms resolution on Windows
  • Qt::VeryCoarseTimer: 1000 ms resolution on all platforms

My question is is there something similar in qt 4.8 and if true, how to set it?

Samer
  • 1,923
  • 3
  • 34
  • 54
  • Did you try [`QObject::startTimer`](http://qt-project.org/doc/qt-4.8/qobject.html#startTimer) + [`QObject::timerEvent`](http://qt-project.org/doc/qt-4.8/qobject.html#timerEvent)? But maybe it's not more precise than QTimer... – leemes Oct 16 '14 at 21:28

1 Answers1

3

Qt4 does not provide high-precision timers. If you want high-precision timers, you need to either migrate to Qt5 or use another library.

For example, you could try this: http://www.boost.org/doc/libs/1_56_0/doc/html/boost_asio/reference/high_resolution_timer.html

ypnos
  • 50,202
  • 14
  • 95
  • 141