开发者

Qt Timer Problem

开发者 https://www.devze.com 2023-02-03 14:34 出处:网络
I have a timer 开发者_开发百科whose tick time is 100. but it tick 125 msec.So ireduced the tick time from 100 to 80, but i still tick approximately 125 msec again. This timer is in main thread. How ca

I have a timer 开发者_开发百科whose tick time is 100. but it tick 125 msec.So i reduced the tick time from 100 to 80, but i still tick approximately 125 msec again. This timer is in main thread. How can i solve this problem? and i m open any suggestions. Any help will be appreciated.


See http://doc.qt.nokia.com/4.2/qtimer.html

.... a timer cannot fire while your application is busy doing something else. In other words: the accuracy of timers depends on the granularity of your application.

and

Note that QTimer's accuracy depends on the underlying operating system and hardware. ... If Qt is unable to deliver the requested number of timer clicks, it will silently discard some.

NOTE: Some older version of Qt use other api that give 20-50ms accuracy.

All non-realtime OS give no guarantee on sleep time and it depends on your cpu power and how bust your system is, you should never relay on this.

0

精彩评论

暂无评论...
验证码 换一张
取 消