[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Of time scaling and FPS
On Thu, May 09, 2002 at 08:47:55AM +0100, Katie Lauren Lucas wrote:
> Yes. Gettime(2) returns the current time in SECONDS. You'd be wanting to
> retrieve it by calling gettimeofday(2) which fills in a structure which
> contains seconds and microseconds since 00:00 Jan 1 1970.
> You can then do the subtraction, do the carry between the seconds field and
> microseconds field and then you have a microseconds difference since the
> last frame to play with as you will. It's not 100% accurate (what is) but I
> can't recall what precision you can expect. I've certainly not had any issues
> in treating it as milli-second accurate.
>  You could just convert the numbers to float and subtract then, BUT the
> numbers as they stand are too big to convert to float without loosing precision.
If you want a float it is easy enought to do the integer subtraction
becasue you can skip the carry. You just take the two signed results
of the subtaction, convert to float, scale to the same units and add.
Christopher John Purnell | I thought I'd found a reason to live
http://www.lost.org.uk/ | Just like before when I was a child
--------------------------| Only to find that dreams made of sand
What gods do you pray to? | Would just fall apart and slip through my hands