Re: timers
VR_at_MSDN.COM
Date: 04/16/04
- Next message: VR_at_MSDN.COM: "Re: timers"
- Previous message: Jeff Partch [MVP]: "Re: OnCtlColor - wierd behaviour"
- In reply to: Gary Chang: "RE: timers"
- Next in thread: Gary Chang: "Re: timers"
- Reply: Gary Chang: "Re: timers"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 16 Apr 2004 08:34:34 -0700
Thanks for the post.
Do you know if Windows98 supports high-resolution timers:
QueryPerformanceFrequency() and timeSetEvent()?
Thanks,
VR
"Gary Chang" <v-garych@online.microsoft.com> wrote in message
news:PTnHzY2IEHA.2972@cpmsftngxa06.phx.gbl...
> Hi,
>
> >I am having problems with timers, or more like the rate at which they go
> off. In this particular example I am setting a timer to go off every 25
> milliseconds (40Hz rate). Judging by my printf's in DoTimer() function,
the
> timer goes off at 32Hz rate. Another words, instead of going off every 25
> milliseconds it goes off every 31 (or so) milliseconds.
> >
>
> "In Windows 98, the timer has the same 55-msec resolution as the
underlying
> PC timer. In Microsoft Windows NT, the resolution of the timer is about 10
> msec.
>
> A Windows application cannot receive WM_TIMER messages at a rate faster
> than this resolution¡ªabout 18.2 times per second under Windows 98 and
> about 100 times per second under Windows NT. Windows rounds down the
> time-out interval you specify in the SetTimer call to an integral multiple
> of clock ticks. For instance, a 1000-msec interval divided by 54.925 msec
> is 18.207 clock ticks, which is rounded down to 18 clock ticks, which is
> really a 989-msec interval. For intervals shorter than 55 msec, each clock
> tick generates a single WM_TIMER message. ... In fact, Windows handles
> WM_TIMER messages much like WM_PAINT messages. Both these messages are low
> priority, and the program will receive them only if the message queue has
> no other messages."
> (From Chapter 8 in the Charles Petzold's 10th Anniversary Edition of
> Programming Windows)
>
> I test your program in the Windows 2000, it appears the timer's resolution
> is also 10ms.
> So I suggest you can use other timers which have the higher resolution,
> such as Multimedia Timers or the kernel timer:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/ht
> m/_win32_multimedia_timers.asp
>
>
> Thanks!
>
> Best regards,
>
> Gary Chang
> Microsoft Online Partner Support
>
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> --------------------
>
- Next message: VR_at_MSDN.COM: "Re: timers"
- Previous message: Jeff Partch [MVP]: "Re: OnCtlColor - wierd behaviour"
- In reply to: Gary Chang: "RE: timers"
- Next in thread: Gary Chang: "Re: timers"
- Reply: Gary Chang: "Re: timers"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|