9 typedef std::chrono::high_resolution_clock clock_t;
16 start_ = clock_t::now();
45 return calcElapsed_();
52 start_ = clock_t::now() -
53 std::chrono::microseconds(
static_cast<long>(
elapsed_ * 1e6));
62 std::chrono::time_point<clock_t> start_;
64 double calcElapsed_()
const {
65 const auto end = clock_t::now();
66 return std::chrono::duration_cast<std::chrono::microseconds>(end - start_)
Stopwatch implementation to measure elapsed time.
Definition: Stopwatch.hpp:8
bool running_
Definition: Stopwatch.hpp:59
void reset()
Stops the timer and sets elapsed time to zero.
Definition: Stopwatch.hpp:23
double elapsed_
Definition: Stopwatch.hpp:58
double stop()
Stops the timer.
Definition: Stopwatch.hpp:32
void start()
Starts the timer.
Definition: Stopwatch.hpp:15
void resume()
Continues the stop watch from when it was stopped.
Definition: Stopwatch.hpp:51
double elapsed() const
Elapsed time in seconds.
Definition: Stopwatch.hpp:41