[AD] use double for al_current_time and al_rest?

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


Should we change

unsigned long al_current_time(void)
void al_rest(long msecs)

to

double al_current_time(void)
void al_rest(double seconds)

and also have them both use seconds?

The advantages would be:

- No implicit guarantee of providing milliseconds accuracy - I don't
think we always can do that.

- No limit to milliseconds resolution, when we actually often can do
much better with all those high precision timers the OS provides these
days.

- Seconds as unit seems to be the least surprise, instead of arbitrarily
using one of milli, micro or nano seconds requiring to check docs each
time.

- No trouble with comparing unsigned to signed numbers.

- No wrap-around. Milli-second precision would be kept up for 200000
years of continuously running the program (microsecond precision for 200
years, nanoseconds for 90 days).. with uint32_t it already would wrap
around after 50 days. (uint64_t of course would only wrap after billions
of years)

And I don't see any disadvantages right now..

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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