DDNet documentation
Loading...
Searching...
No Matches
Time

Enumerations

enum class  ETimeSeason {
  ETimeSeason::SPRING , ETimeSeason::SUMMER , ETimeSeason::AUTUMN , ETimeSeason::WINTER ,
  ETimeSeason::EASTER , ETimeSeason::HALLOWEEN , ETimeSeason::XMAS , ETimeSeason::NEWYEAR
}

Functions

void set_new_tick ()
std::chrono::nanoseconds time_get_nanoseconds ()
int64_t time_get_impl ()
int64_t time_get ()
int64_t time_freq ()
int time_houroftheday ()
ETimeSeason time_season ()

Detailed Description

Time utilities.

Timestamps

Enumeration Type Documentation

◆ ETimeSeason

enum class ETimeSeason
strong

A season of the year or seasonal event.

Enumerator
SPRING 
SUMMER 
AUTUMN 
WINTER 
EASTER 
HALLOWEEN 
XMAS 
NEWYEAR 

Function Documentation

◆ set_new_tick()

void set_new_tick ( )

Clears the cached sample of the high resolution timer.

See also
time_get

◆ time_freq()

int64_t time_freq ( )
Returns
The frequency of the high resolution timer.

◆ time_get()

int64_t time_get ( )

Fetches a cached sample from a high resolution timer.

Returns
Current value of the timer.
Remarks
To know how fast the timer is ticking, see time_freq.
The value is cached for each tick, see set_new_tick. Uses time_get_impl to fetch the uncached sample.
See also
time_freq time_get_impl

◆ time_get_impl()

int64_t time_get_impl ( )

Fetches a sample from a high resolution timer.

Returns
Current value of the timer.
Remarks
To know how fast the timer is ticking, see time_freq.
See also
time_freq

◆ time_get_nanoseconds()

std::chrono::nanoseconds time_get_nanoseconds ( )

Fetches a sample from a high resolution timer and converts it to nanoseconds.

Returns
Current value of the timer in nanoseconds.

◆ time_houroftheday()

int time_houroftheday ( )

Retrieves the hours since midnight (0..23).

Returns
The current hour of the day.

◆ time_season()

ETimeSeason time_season ( )

Retrieves the current season or event of the year.

Returns
The current season or event, see ETimeSeason.