Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetTimer not getting called every 20ms

Status
Not open for further replies.

tpremore

Technical User
Apr 13, 2001
22
0
0
US
I have a SetTimer call:
SetTimer(1, 20, NULL);

And a handler:
void Xxx::OnTimer(UINT nIDEvent)
{
...

if(nIDEvent == 1)
{
...
}
}

But the Handler code is not being called every 20ms as requested. Is this dependent on the Machine on which it runs, or the operating system as to whether it can keep up with this high rate of function calling?
Is there something faster that can be used?

Thank you in advance for any advice!!
:)

-Travis
 
The resolution of the Windows timer is approx 55 mSec so you can't get the time that you require. To make matters worse, the timer events get added to the application's message queue so they are not acted upon until other messages have been processed.

If you need accurate time intevals, use a multimedia timer. If you need a code frag let me know.

It would help if you let me know if you are using C++ or just plain 'C'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top