These functions are declared in the main Allegro header file:

     #include <allegro5/allegro.h>

# ALLEGRO_TIMEOUT

    typedef struct ALLEGRO_TIMEOUT ALLEGRO_TIMEOUT;

Source Code

Represent a timeout value. The size of the structure is known so it can be statically allocated. The contents are private.

See also: al_init_timeout

Examples:

- ex_timedwait.c

# al_get_time

    double al_get_time(void)

Source Code

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.

Examples:

- ex_convert.c
- ex_d3d.cpp
- ex_enet_server.c

# al_init_timeout

    void al_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds)

Source Code

Set timeout value of some number of seconds after the function call.

For compatibility with all platforms, `seconds` must be 2,147,483.647 seconds or less.

See also: ALLEGRO_TIMEOUT, al_wait_for_event_until

Examples:

- ex_timedwait.c

# al_rest

    void al_rest(double seconds)

Source Code

Waits for the specified number of seconds. This tells the system to pause the current thread for the given amount of time. With some operating systems, the accuracy can be in the order of 10ms. That is, even

    al_rest(0.000001)

might pause for something like 10ms. Also see the section on Timer routines for easier ways to time your program without using up all CPU.

Examples:

- ex_keyboard_focus.c
- ex_timer_pause.c
- ex_mouse_focus.c

Allegro version 5.2.8 - Last updated: 2023-06-20 15:35:53 UTC