1 #include <chrono> 2 using namespace std::chrono; 3 class Timer { 4 public: Timer()5 Timer() { start_time = steady_clock::now(); } 6 ~Timer()7 ~Timer() { stop_time = steady_clock::now(); } 8 get_elapsed_time_ms()9 double get_elapsed_time_ms() { 10 auto current_time = std::chrono::steady_clock::now(); 11 return duration_cast<milliseconds>(current_time - start_time).count(); 12 } 13 14 private: 15 time_point<steady_clock> start_time; 16 time_point<steady_clock> stop_time; 17 };