Re: [AD] use double for al_current_time and al_rest?

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


On 2007-12-29, Victor <vwss1984@xxxxxxxxxx> wrote:
> I agree, calendar time is almost useless for games. However some
> helper functions can easily get the number of
> nanos/micros/millis/years between two calendar times.

Which is backwards as all operating systems I know of provide high
precision micro/nanoseconds relative to some arbitrary offset, with
conversion functions into calendar time, not the other way around.  Your
suggestion would have us do two (complicated) conversions for the common
case.

> Ron Novy <ron.novy@xxxxxxxxxx> escreveu: Why not use a counter that is
> reset every call instead of a timer.  Use a function like
> al_get_counter or something and have it return a double or have
> multiple versions like al_get_counter (unsigned long) and
> al_get_counter_d (double)... This would give infinite resolution and
> make time relative to the app/game/thread using it...

That's horrible for multithreaded programs, unless the counter is
thread-local.  Even then, it's horrible as soon as you have two time
intervals to track within the one OS thread.  In any case, we use
al_current_time() for the time stamp in events.  We need a global
reference for that.

Peter





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