QT设置超时的方法,请指教

weijunzia 发布于 2014/07/25 20:11
阅读 2K+
收藏 0
Qt
QT下除了QTimer之外,怎么设置超时?要求超时的时间很短,例如50ms,不能用QTimer是因为它的精度不够,在运行时总是会有2ms-20ms的误差,误差超过10ms就无法忍受了。所以,想请问,有没有更好的设置超时的方法?
加载中
0
hehuim
hehuim

The accuracy of timers depends on the underlying operating system and hardware.

The accuracy also depends on the timer type. For Qt::PreciseTimer, QTimer will try to keep the accurance at 1 millisecond. Precise timers will also never time out earlier than expected.

void setTimerType(Qt::TimerType atype)试试这个。

weijunzia
weijunzia
多谢
0
dosmlp
dosmlp
用系统函数,不是有个能读取CPU时钟精确到微秒吗
返回顶部
顶部