[SDL] Making 200Hz timer for Physics simulation code

Fro Joe tennies at uwplatt.edu
Thu Jan 17 12:51:01 PST 2002


First, you are going to need some custom interrupt code to make it exact.

You could average out the error by having a timer go off every 10ms and do
something once and then do the math for again for somethign 5 ms later
(assume nothing will change in the next 5 ms).  (probably not a good option
from the way you sound.)

I don't think any OS under the SDL will support that (I may be wrong).  You
should probably look for a different library if your constraints are that
high.  I could hack something for that in Windows, but it wouldn't be pretty
=)  Actually, if you wouldn't mind it going off every 4ms, I could do that
in a fairly simple way.

SDL is for games.  I don't think it would be what you are looking for.
Actually, if you want such a precise measurement, you should look into a
RTOS that could probably keep up with that.

So I guess my answers are:
Try a RTOS
Make special hardware
I could HACK something for you... keyword: HACK

----- Original Message -----
From: "Timo K Suoranta" <tksuoran at cc.helsinki.fi>
To: <sdl at libsdl.org>
Sent: Thursday, January 17, 2002 1:42 PM
Subject: [SDL] Making 200Hz timer for Physics simulation code


>
> Can anyone suggest me how to make a timer which runs at 200Hz my simple
> physics simulation code?
>
> Don't tell me to lower the frequency, I'm only interested in replies which
> actually let me know how to do it.
>
> Will SDL Timer with interval of 5 ms do? Which platforms can/can not do
> this?
>
>
> -- Timo Suoranta -- tksuoran at cc.helsinki.fi --
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl





More information about the SDL mailing list