Re: [AD] SetTimer for the timer

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2006-01-09, Chris <chris.kcat@xxxxxxxxxx> wrote:
> Has anyone thought about using the SetTimer function to implement Allegro's 
> timer routines?

Apparently it is not very accurate though.  For example:

  http://www.compuphase.com/vbtiming.htm

  The standard Windows timer (the SetTimer function) has two major problems:

  * on Windows 95/98/ME it is accurate only to multiples of approximately
  55 ms, which is too coarse for most purposes; on Windows NT/2000/XP it has an
  accuracy of 10 ms by default, which could also be improved upon

  * it has the very lowest level in the hierarchy of the Windows
  event/message generating system; that is, the timer event/message may be
  postponed, or even not be generated at all, if there is any other event that in
  the queue 

The second point is confirmed here:

  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timermessages/wm_timer.asp

  The WM_TIMER message is a low-priority message. The GetMessage and
  PeekMessage functions post this message only when no other
  higher-priority messages are in the thread's message queue.

Of course, it would be best to try it out and compare it against the
current implementation.

> It seems these would fit better than the current hackish way 
> of running a timed thread.

Why is it hackish?  It's pretty straight forward.

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/