Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#include <chrono>
class WinTimer {
// create and start timer
WinTimer() { reset(); }
// return ticks since timer creation or last reset
auto ticks() const
return (clock::now() - mTimeStart).count();
void reset() { mTimeStart = clock::now(); }
static auto ticksPerSecond()
double den = clock::duration::period::den;
return den / clock::duration::period::num;
using clock = std::chrono::high_resolution_clock;
clock::time_point mTimeStart;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.