Fireworks Engine  v2.0
Lightweight Sandbox Game Engine using OpenGL for additional Customisation and Quick Prototyping
timer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <chrono>
4 
5 namespace fireworks { namespace utils {
6 
8  class Timer
9  {
10  private:
11  typedef std::chrono::high_resolution_clock HighResolutionClock;
12  typedef std::chrono::duration<float, std::milli> milliseconds_type;
13  std::chrono::time_point<HighResolutionClock> m_Start;
14  public:
17  {
18  reset();
19  }
20 
22  void reset()
23  {
24  m_Start = HighResolutionClock::now();
25  }
26 
28  float elapsedTime()
29  {
30  return std::chrono::duration_cast<milliseconds_type>(HighResolutionClock::now() - m_Start).count() / 1000.0f;
31  }
32  };
33 } }
Timer()
Simple Initializer of the timer object that.
Definition: timer.h:16
Timer class to keep track of the time.
Definition: timer.h:8
Definition: audioclip.cpp:3
float elapsedTime()
The completion time in milli seconds since the first frame was renderer.
Definition: timer.h:28
void reset()
resets the timer to current time
Definition: timer.h:22