SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Clock.h
1#pragma once
2
3namespace spark::lib
4{
5 template <typename T> requires IsDuration<T>
6 float Clock::elapsedTime() const
7 {
8 return std::chrono::duration<float, typename T::period>(std::chrono::steady_clock::now() - m_startTime).count();
9 }
10
11 template <typename T> requires IsDuration<T>
13 {
14 const auto elapsed = elapsedTime<T>();
15 m_startTime = std::chrono::steady_clock::now();
16 return elapsed;
17 }
18}
void restart()
Restarts the clock.
Definition Clock.cpp:8
float elapsedTime() const
Gets the elapsed time since the clock start.
Definition Clock.h:6
Definition Clock.h:16