diff options
Diffstat (limited to 'src/Time.cpp')
| -rw-r--r-- | src/Time.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Time.cpp b/src/Time.cpp index e459374..1953fed 100644 --- a/src/Time.cpp +++ b/src/Time.cpp @@ -1,4 +1,5 @@ #include "Time.hpp" +#include "Common/Casts.hpp" #include <chrono> #include <algorithm> @@ -10,7 +11,7 @@ void Time::start_frame() { void Time::end_frame() { auto frame_end = now(); - m_delta = (frame_end - m_current_frame_start) / 1000.0; + m_delta = TO(Real, frame_end - m_current_frame_start) / 1000.0; m_delta = std::clamp(m_delta, delta_min, delta_max); m_total_frames++; @@ -28,6 +29,10 @@ Real Time::delta() const { return m_delta; } +Time::Timestamp Time::frame_start() const { + return m_current_frame_start; +} + Time::Timestamp Time::now() { auto time = std::chrono::system_clock::now().time_since_epoch(); auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(time); |
