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

Re: Question about timing



Erik wrote:

> hrm, indeed, I am in err. That'll teach me to listen to windows coders... I'm
> going to theorize that the reason it worked for me is because my programs
> didn't sleep, they continually rendered to acheive the fastest frame rate, so
> the load that program was requesting was 1. I'm not sure how threading would
> work, but in a single thread program that polls input and renders as fast as it
> can, clock() does the job.

Well, even if your program doesn't sleep, doesn't get stuck waiting for
vertical retrace, I/O, etc - clock() still won't return 'realtime' if
there is another program running somewhere in the machine.  This is
*UNIX* and you should certainly expect there to be other programs
sharing your resources.

> gettimeofday() is probably a much better solution.

Yep.

-- 
Steve Baker                  http://web2.airmail.net/sjbaker1
sjbaker1@airmail.net (home)  http://www.woodsoup.org/~sbaker
sjbaker@hti.com      (work)

---------------------------------------------------------------------
To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: linuxgames-help@sunsite.auc.dk