KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches

Maintaining time since system boot. More...

Functions

timer_val_t __dreamcast_get_ticks (void)
 Get the current uptime of the system (in seconds and ticks).
 
static struct timespec arch_timer_gettime (void)
 Get the current uptime of the system (in seconds and nanoseconds).
 

Detailed Description

Maintaining time since system boot.

This API provides methods for querying the current system boot time or uptime since KOS started at various resolutions. You can use this timing for ticks, delta time, or frame deltas for games, profilers, or media decoding.

Note
This API is used to back the C, C++, and POSIX standard date/time APIs. You may wish to favor these for platform independence.
Warning
This API and its underlying functionality are using TMU2, so any direct manipulation of it will interfere with the API's proper functioning.
Note
The highest actual tick resolution of TMU2 is 80ns.

Function Documentation

◆ __dreamcast_get_ticks()

timer_val_t __dreamcast_get_ticks ( void )

Get the current uptime of the system (in seconds and ticks).

This function retrieves the number of seconds and ticks since KOS was started.

Returns
The time since KOS started as a timer_val_t.

Referenced by arch_timer_gettime().

◆ arch_timer_gettime()

static struct timespec arch_timer_gettime ( void )
inlinestatic

Get the current uptime of the system (in seconds and nanoseconds).

This function retrieves the time since KOS was started, in a standard timespec format.

Returns
The time since KOS started as a struct timespec.

References __dreamcast_get_ticks().

Referenced by timer_gettime().