[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Of time scaling and FPS



Dmitry Samoyloff wrote:
> 
> 11 May 2002 02:52, Steve Baker wrote:
> > Use gettimeofday - it's good to *microseconds*.
> 
> However, that's not a portable way :-(

Well, no - but the SDL way is only portable because inside it says
something like:

 #ifdef LINUX
   ...gettimeofday...
 #elif WINDOZE
   ...some ghastly "Performance Timer" thingy under
   some versions of Windoze - 'timeGetTime' otherwise.
 #elif IRIX
   ...use the 'fast itimer'...
 #elif
   ...and so on.

So, you just have to collect a suitable set of timer routines and
wrap them up so you just call:

  t1 = my_timer_code () ;

...once 'my_timer_code' is written, you can forget about it.

Or you could always head over to plib.sf.net and check out the 'ulClock'
code...it's all there for you.
 
----------------------------- Steve Baker -------------------------------
Mail : <sjbaker1@airmail.net>   WorkMail: <sjbaker@link.com>
URLs : http://www.sjbaker.org
       http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
       http://prettypoly.sf.net http://freeglut.sf.net
       http://toobular.sf.net   http://lodestone.sf.net