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
10namespace 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 {
30 }
31
32 double dt() noexcept
33 {
34 return s_delta_time;
35 }
36 } // namespace time
37} // namespace galaxy
double dt() noexcept
Get galaxy delta time.
Definition Time.cpp:32
static double s_delta_time
Definition Time.cpp:14
void dt(const double dt) noexcept
Set galaxy delta time.
Definition Time.cpp:27
auto now() noexcept -> std::chrono::local_time< std::chrono::system_clock::duration >
Current local time.
Definition Time.cpp:16
std::uint64_t time_since_epoch() noexcept
Time since epoch.
Definition Time.cpp:21
Application.hpp galaxy.
STL namespace.