PDA

View Full Version : Doubt about QTimer



sudheer168
19th September 2008, 14:00
Hi,
I am using two timers in one button click event.
1: will call a function for every 1ms and
2: will call a function for every 3ms .
The timer 1 will read data form port and insert into database and timer 2 will read data from database and do the functionality.
Here my problem is whether one timer will slow down the process of other timer .I observed it is happening so.Here i need to run the two process with same speed with out slowing down.
And one thing i need to clear is whether any QTimer function slow downs after some time ie after 15min.If so how to solve this problem.
so please suggest and help me to solve these doubts(problems).


With Regards,
Sudheer

maverick_pol
19th September 2008, 14:06
Hi,

Are you sure that it is "QTimer" slowing down?
Theoretically, there should be not loss of timer speed. Could you paste a bit of code where you create/use/connect your timers?

Thanks,

Kacper

caduel
19th September 2008, 14:07
It should not slow down.
But note that your linux probably is no real time OS and does not guarantee millisecond precision (and nor does Qt). If your machine is busy or your program's thread / process has bad luck with scheduling this time may (will) be larger.

from QTimer's docs:

Note that QTimer's accuracy depends on the underlying operating system and hardware. Most platforms support an accuracy of 1 millisecond, but Windows 98 supports only 55. If Qt is unable to deliver the requested number of timer clicks, it will silently discard some.

HTH

maverick_pol
19th September 2008, 14:12
Yes, that's right.

That sounds like would have to have a timer sending timeout() from another process to have a better precision.
Did you think about other solutions not including QTimer ?

Kacper

sudheer168
22nd September 2008, 13:46
Thanks everybody for giving me reply