galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::time Namespace Reference

Functions

auto now () noexcept -> std::chrono::local_time< std::chrono::system_clock::duration >
 Current local time.
std::uint64_t time_since_epoch () noexcept
 Time since epoch.
void dt (const double dt) noexcept
 Set galaxy delta time.
double dt () noexcept
 Get galaxy delta time.
void delay (const int milli) noexcept
 Delay the current thread for x time.
std::uint64_t ms_to_ns (const std::uint64_t ms) noexcept
 Converts milliseconds to nanoseconds.
std::uint64_t ns_to_ms (const std::uint64_t ns) noexcept
 Converts nanoseconds to milliseconds.
std::uint64_t ns_to_s (const std::uint64_t ns) noexcept
 Converts nanoseconds to seconds.
std::uint64_t ns_to_us (const std::uint64_t ns) noexcept
 Converts nanoseconds to microseconds.
std::uint64_t s_to_ns (const std::uint64_t s) noexcept
 Converts seconds to nanoseconds.
std::uint64_t us_to_ns (const std::uint64_t us) noexcept
 Converts microseconds to nanoseconds.

Variables

static double s_delta_time = 0.0

Function Documentation

◆ now()

auto galaxy::time::now ( ) -> std::chrono::local_time< std::chrono::system_clock::duration >
nodiscardnoexcept

Current local time.

Returns
Time as a chrono duration.

Definition at line 18 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_since_epoch()

std::uint64_t galaxy::time::time_since_epoch ( )
nodiscardnoexcept

Time since epoch.

Returns
Nanoseconds.

Definition at line 23 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dt() [1/2]

void galaxy::time::dt ( const double dt)
noexcept

Set galaxy delta time.

Parameters
dtDelta-Time.

Definition at line 29 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dt() [2/2]

double galaxy::time::dt ( )
nodiscardnoexcept

Get galaxy delta time.

Returns
Current lag from gameloop.

Definition at line 34 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ delay()

void galaxy::time::delay ( const int milli)
noexcept

Delay the current thread for x time.

Parameters
milliNumber of milliseconds to wait.

Definition at line 39 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ms_to_ns()

std::uint64_t galaxy::time::ms_to_ns ( const std::uint64_t ms)
nodiscardnoexcept

Converts milliseconds to nanoseconds.

Parameters
msMilliseconds.
Returns
Nanoseconds.

Definition at line 44 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ns_to_ms()

std::uint64_t galaxy::time::ns_to_ms ( const std::uint64_t ns)
nodiscardnoexcept

Converts nanoseconds to milliseconds.

Parameters
nsNanoseconds.
Returns
Milliseconds.

Definition at line 49 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ns_to_s()

std::uint64_t galaxy::time::ns_to_s ( const std::uint64_t ns)
nodiscardnoexcept

Converts nanoseconds to seconds.

Parameters
nsNanoseconds.
Returns
Seconds.

Definition at line 54 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ns_to_us()

std::uint64_t galaxy::time::ns_to_us ( const std::uint64_t ns)
nodiscardnoexcept

Converts nanoseconds to microseconds.

Parameters
nsNanoseconds.
Returns
Microseconds.

Definition at line 59 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_to_ns()

std::uint64_t galaxy::time::s_to_ns ( const std::uint64_t s)
nodiscardnoexcept

Converts seconds to nanoseconds.

Parameters
sSeconds.
Returns
Nanoseconds.

Definition at line 64 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ us_to_ns()

std::uint64_t galaxy::time::us_to_ns ( const std::uint64_t us)
nodiscardnoexcept

Converts microseconds to nanoseconds.

Parameters
usMicroseconds.
Returns
Nanoseconds.

Definition at line 69 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ s_delta_time

double galaxy::time::s_delta_time = 0.0
static

Definition at line 16 of file Time.cpp.