sgltk 0.6
Simple OpenGL Tool Kit
Loading...
Searching...
No Matches
timer.cpp
1#include "timer.h"
2
3using namespace sgltk;
4
5Timer::Timer() {
6 start();
7}
8
9Timer::~Timer() {
10}
11
13 start_time = std::chrono::high_resolution_clock::now();
14}
15
17 std::chrono::high_resolution_clock::time_point end_time =
18 std::chrono::high_resolution_clock::now();
19 std::chrono::duration<double> dt = end_time - start_time;
20
21 return dt.count();
22}
23
25 std::chrono::high_resolution_clock::time_point end_time =
26 std::chrono::high_resolution_clock::now();
27 std::chrono::duration<double, std::milli> dt = end_time - start_time;
28
29 return dt.count();
30}
void start()
Starts the timer.
Definition timer.cpp:12
double get_time_s()
Returns the time in seconds since the timer was started.
Definition timer.cpp:16
double get_time_ms()
Returns the time in milliseconds since the timer was started.
Definition timer.cpp:24