commonlib
timer.h
1 #pragma once
2 
3 #include "synchronization.h"
4 #include <chrono>
5 
6 BEGIN_NAMESPACE_SYNCHRONIZATION
7 
8 class Timer
9 {
10 public:
11  Timer();
12 
13  void reset();
14  double elapsed() const;
15  double elapsedMs() const;
16 
17 private:
18  using clock_ = std::chrono::high_resolution_clock;
19  using second_ = std::chrono::duration<double, std::ratio<1>>;
20 
21  std::chrono::time_point<clock_> beg_;
22 };
23 
24 END_NAMESPACE_SYNCHRONIZATION
Definition: timer.h:8