Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Timer/Time milliseconds?

This thread is locked; no one can reply to it. rss feed Print
Timer/Time milliseconds?
CRAZY CONDITIONS
Member #16,385
June 2016
avatar

When writing an Allegro program for Android, what time unit is used by al_create_timer() and al_get_time()?
Milliseconds or microseconds or does it depend on something else like hardware, driver or operating system?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

CRAZY CONDITIONS
Member #16,385
June 2016
avatar

I don't understand this in the API reference:

al_get_time:

Return the number of seconds since the Allegro library was initialised. The return value is undefined if Allegro is uninitialised. The resolution depends on the used driver, but typically can be in the order of microseconds.

What is the Resolution? The time unit is ALWAYS seconds?

Audric
Member #907
January 2001

It is expressed in seconds. 1 is one second, 0.5 is 500 milliseconds. You can type 1.0/60.0 when you want to express 1/60th of a second (Not the same as 1/60 !).

The resolution is the 'level of detail' of the returned number. If I understand correctly, it means you typically obtain a number such as 0.12345600000000000 (The last 6 is microseconds)

The docs say 'typically' because the same documentation applies to many operating systems where Allegro is implemented. If one OS/driver has worse precision, the relevant API may only produce numbers with zeroes under milliseconds (0.123000000000)

Go to: