sgltk
0.6
Simple OpenGL Tool Kit
Loading...
Searching...
No Matches
src
timer.cpp
1
#include "timer.h"
2
3
using namespace
sgltk;
4
5
Timer::Timer() {
6
start
();
7
}
8
9
Timer::~Timer() {
10
}
11
12
void
Timer::start
() {
13
start_time = std::chrono::high_resolution_clock::now();
14
}
15
16
double
Timer::get_time_s
() {
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
24
double
Timer::get_time_ms
() {
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
}
sgltk::Timer::start
void start()
Starts the timer.
Definition
timer.cpp:12
sgltk::Timer::get_time_s
double get_time_s()
Returns the time in seconds since the timer was started.
Definition
timer.cpp:16
sgltk::Timer::get_time_ms
double get_time_ms()
Returns the time in milliseconds since the timer was started.
Definition
timer.cpp:24
Generated on
for sgltk by
1.14.0