Board index » Visual Studio » Timing Problem

Timing Problem

Visual Studio372
Hi,



I am writing an application, which needs to do some stuff about every 10 ms.

My problem is, that the SetTimer MFC method, is safe only down to about 55

ms.

Is there any way to use a callback function every 10 ms ?



Thank you,



Corkwick


-
 

Re:Timing Problem

You could use the multimedia timers, they are accurate down to the

millisecond.



Look at the multimedia platform sdk.





http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/library/en-us/multimed/mmtime_4msz.asp



joe

#











"Corkwick" <corkwick@web.de>wrote in message

Quote
Hi,



I am writing an application, which needs to do some stuff about every 10

ms.

My problem is, that the SetTimer MFC method, is safe only down to about 55

ms.

Is there any way to use a callback function every 10 ms ?



Thank you,



Corkwick









-

Re:Timing Problem

Another optimist. Dream on. You will never get reliable 10ms timing. You can come close,

but don't assume it is possible.



WM_TIMER has as its best resolution the resolution of the system clock, which on MS-DOS is

55ms. On good days, if you are lucky, and the system isn't too busy, and the user is not

playing solitaire, and the network is quiet, you will actually get the WM_TIMER message

every 55ms, but it might be 60, or some other even larger value. Perhaps a week or two

delay is possible (I'm not kidding).



You can use the multimedia timers and on the whole you will get reasonably accurate

callbacks, most of which will be about 10ms, some of which may be 11ms, or 12ms, etc., and

some of which may be a week.



Read my essay on "Time is the simplest thing" on my MVP Tips site. It isn't, of course,

which is part of why I chose the title.



But if you really need every 10ms, no general-purpose computing platform, including Linux,

Unix, etc. will ever give you the accuracy you want.

joe



On Sun, 13 Jul 2003 14:08:16 +0200, "Corkwick" <corkwick@web.de>wrote:



Quote
Hi,



I am writing an application, which needs to do some stuff about every 10 ms.

My problem is, that the SetTimer MFC method, is safe only down to about 55

ms.

Is there any way to use a callback function every 10 ms ?



Thank you,



Corkwick





Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm

-