Euphoria
timer.cc
Go to the documentation of this file.
1 #include "window/timer.h"
2 
3 #include "SDL_timer.h"
4 
5 #include "base/cint.h"
6 
7 namespace eu::window
8 {
10  : current_time(SDL_GetPerformanceCounter())
11  , last_time(0)
12  {
13  }
14 
15  float
17  {
19  current_time = SDL_GetPerformanceCounter();
20 
21  const float dt = c_u64_to_float(current_time - last_time) / c_u64_to_float(SDL_GetPerformanceFrequency());
22  return dt;
23  }
24 }
constexpr float c_u64_to_float(U64 i)
Definition: cint.h:57
float update()
Definition: timer.cc:16
Uint64 current_time
Definition: timer.h:15
Uint64 last_time
Definition: timer.h:16