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
Time.cpp
Go to the documentation of this file.
1
7
8
#include "
Time.hpp
"
9
10
namespace
galaxy
11
{
12
namespace
time
13
{
14
static
double
s_delta_time
= 0.0;
15
16
auto
now
() noexcept ->
std
::chrono::local_time<
std
::chrono::system_clock::duration>
17
{
18
return
std::chrono::zoned_time {std::chrono::current_zone(), std::chrono::system_clock::now()}.get_local_time();
19
}
20
21
std::uint64_t
time_since_epoch
() noexcept
22
{
23
const
auto
duration =
now
().time_since_epoch();
24
return
std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count();
25
}
26
27
void
dt
(
const
double
dt
)
noexcept
28
{
29
s_delta_time
=
dt
;
30
}
31
32
double
dt
() noexcept
33
{
34
return
s_delta_time
;
35
}
36
}
// namespace time
37
}
// namespace galaxy
Time.hpp
galaxy::time
Definition
Time.cpp:13
galaxy::time::dt
double dt() noexcept
Get galaxy delta time.
Definition
Time.cpp:32
galaxy::time::s_delta_time
static double s_delta_time
Definition
Time.cpp:14
galaxy::time::dt
void dt(const double dt) noexcept
Set galaxy delta time.
Definition
Time.cpp:27
galaxy::time::now
auto now() noexcept -> std::chrono::local_time< std::chrono::system_clock::duration >
Current local time.
Definition
Time.cpp:16
galaxy::time::time_since_epoch
std::uint64_t time_since_epoch() noexcept
Time since epoch.
Definition
Time.cpp:21
galaxy
Application.hpp galaxy.
Definition
Application.cpp:35
std
STL namespace.
galaxy
src
galaxy
time
Time.cpp
Generated on
for galaxy by
1.17.0