PDA

View Full Version : QTimer Time Resolution



Ashutosh2k1
1st July 2011, 08:02
Hi
Can u set the QTimer Time Resolution to be less then milisecond . Also can the interval value would be in double float etc

squidge
1st July 2011, 08:43
No and No.

If you want accuracy of less than a millisecond, you need platform specific functions.

What are you trying to do?

Ashutosh2k1
1st July 2011, 09:02
Hi
So suppose i have choosen a variable of double for timeinterval and may be value less then 1 milisec lets take .2 so in this case the next timerevent will fire after completion of 1 milisec
in this case there will 5 complete interval but timer event is called only after 1 mili sec or 5 times in amili sec

high_flyer
1st July 2011, 14:17
so in this case the next timerevent will fire after completion of 1 milisec
No.
It will fire as the doc states:

A QTimer with a timeout interval of 0 will time out as soon as all the events in the window system's event queue have been processed.
Which can be any interval.

In addition, saying that the QTimer will fire with 1 ms resolution is also not 100% correct.
QTimer takes interval values in 1 ms resolution.
The actual interval might, and usually does vary, depending on the current system and its state.
Under windows, having a less than 1 ms timer resolution is probably not really practical/possible - I know wysota will laugh at the notion alone.
You might find this interesting:
http://www.qtcentre.org/threads/40317-frame-rate-and-QTimer-accuracy
And if you are on windows:
http://msdn.microsoft.com/en-us/magazine/cc163996.aspx