Re: timers

Tech-Archive recommends: Speed Up your PC by fixing your registry

VR_at_MSDN.COM
Date: 04/16/04


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.
> --------------------
>



Relevant Pages

  • Re: Precise timing
    ... Windows MEssage handling is not ... graphics thread and i had lots of other timers on my graphics. ... right and how different this timeSetEvent would be from SetTimer function. ... Windows CE by some OEM. ...
    (microsoft.public.windowsce.app.development)
  • Re: problem of ntpd on W2K DCs
    ... Guess that those 3 DCs just need some kicks. ... Please nothe that the Windows multimedia timers are not necessarily used ... It does not modify the Windows system time in any way, ...
    (comp.protocols.time.ntp)
  • Re: Getting more precise timing and telling if a key is pressed -
    ... All I need now are more details about the timers and how common they are (my ... It must work with systems as old as Windows 95. ... Win95 support is asking for pain. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Windows Timers
    ... Windows 2k/XP/2k3 Filesystem and Driver Consulting ... > I have a routine which doess some junk operations and gives me delay of 4> milliseconds ... > timers I know that the minimum scheduling time is 15 ms ... > So logically I should get a timer running every 4 milliseconds. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: stalling the TSC?
    ... |>>>the chipset has it in theory) because the current versions of Windows ... This leaves other timers which have various problems, ... |> I believe I wrote a post about this, it still has several stupid warts, ... is such that it is allowed to be be 18,000 ppm out for intervals ...
    (comp.arch)