SYNOPSIS

DESCRIPTION

These functions provide a low-level interface to monotonically increasing
time sources.
Different time backends may be implemented (see
INTERNAL API below).
Agar provides the following backends:

agTimeOps_dummy

No-op, timers will be unavailable.

agTimeOps_posix

Monotonic clock using
clock_gettime() interface

agTimeOps_gettimeofday

Traditional
gettimeofday() interface.

agTimeOps_win32

Windows winmm API.

agTimeOps_renderer

Monotonic clock which stops while graphical rendering is performed.
This is useful for applications performing offline rendering, where the
outcome may be influenced by different threads relying on Agar timers
or
AG_Delay() calls.

INTERFACE

Uint32AG_GetTicks (void)

voidAG_Delay (Uint32 t)

voidAG_SetTimeOps (const AG_TimeOps *ops)

The
AG_GetTicks() function returns the current time in ticks.
One tick usually corresponds to one millisecond.

The
AG_Delay() function blocks the current thread, waiting at least
t ticks before returning.
The exact amount of time which
AG_Delay() waits is backend-dependent.

The
AG_SetTimeOps() function selects a time backend (see below).

BACKEND INTERFACE

The argument to
AG_SetTimeOps() should point to the following structure: