[Qt-interest] QTimer on Windows in Unreliable for Small (16ms- 30ms) Delays

Scott Aron Bloom Scott.Bloom at sabgroup.com
Sat Sep 19 03:02:47 CEST 2009


But integrating win32 message events into QT can be daunting..

Some hints on doing it
1) Custom qcoreapplication
2) Implement your own winEventFilter

Scott
-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Malyushytsky, Alex
Sent: Friday, September 18, 2009 5:56 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] QTimer on Windows in Unreliable for Small (16ms- 30ms) Delays

Wouldn't msdn help?

http://msdn.microsoft.com/en-us/library/dd757664%28VS.85%29.aspx

Regards,
 Alex

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Josiah Bryan
Sent: Friday, September 18, 2009 5:28 PM
To: Thiago Macieira
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] QTimer on Windows in Unreliable for Small (16ms - 30ms) Delays

Thiago Macieira wrote:
> Em Segunda-feira 7. Setembro 2009, às 02.48.17, você escreveu:
>> I'm a bit confused - the description for QTimer says:
>>
>> "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"
>>
>> while you said:
>>> That said, QTimer uses the system timer which is unreliable and
>>> inaccurate. You should use the Windows Multimedia Timers if you
>>> something accurate. In fact, QTimer uses multimedia timers for interval
>>> < 10ms (maybe it's <= 10ms, not sure). You can either use 8ms timer and
>>> process every alternate one or use the Windows MM Timer Api directly.
>> so with Win XP, what is the accuracy of QTimer for periods of greater than
>> 10 msecs - is it 1 millisecond or is it more?  Why doesn't QTimer use the
>> Multimedia Timers for all periods?
>
> Because QTimer isn't a precise timer. It's not guaranteed to be and it doesn't
> pretend to be.
>
> If you need high-precision timers, you'll have to find a way of getting them
> yourself. QTimer is meant for normal-priority tasks where being a few
> milliseconds late is ok. Conserving power (reducing the number of CPU wakeups)
> is more important than precision.
>

Thiago - thanks for replying. Sorry for getting to this so late.

I have no problem with a few milliseconds - heck, even 100 or 200ms is
fine once in a while. But averaging 1000ms delays every 5 - 10 seconds -
thats simply unacceptable. I dont need high-precision, but some
resemblance of reliability would be nice. A jump from 33ms to 1000ms is
not just a few milliseconds, thats several orders of magnitude larger.

If theres no way around the 1000ms jump - would you or anyone else at
trolltech be able to offer any code samples on using Win32 multimedia
timers in a Qt app? I havn't been able to dig up any examples of win32
MM timers + Qt since this thread started - and I've been persistent at
google. I've even tried parsing the Qt source tree for how you folks do
it - but I can't seem to separate the MM-specific parts from the rest of
the core. Anything you can offer would be greatly appreciated.

Thanks!
-josiah


--
Josiah Bryan
Productive Concepts, Inc.
jbryan at pciint.com
(765) 964-6009, ext. 224

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

"Please consider our environment before printing this email."

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list