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

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


Float and double suffers from rounding errors. Is this a issue for al_current_time(void)?

Victor Williams Stafusa da Silva

Elias Pschernig <elias@xxxxxxxxxx> escreveu:
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


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--
https://lists.sourceforge.net/lists/listinfo/alleg-developers


Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento!

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