1 // Copyright (c) 2018 ERGO-Code. See license.txt for license. 2 3 #ifndef IPX_TIMER_H_ 4 #define IPX_TIMER_H_ 5 6 #include <chrono> 7 8 namespace ipx { 9 10 class Timer { 11 public: 12 Timer(); 13 double Elapsed() const; 14 void Reset(); 15 16 private: 17 typedef std::chrono::time_point<std::chrono::high_resolution_clock> 18 TimePoint; 19 static TimePoint tic(); 20 static double toc(TimePoint start); 21 TimePoint t0_; 22 }; 23 24 } // namespace ipx 25 26 #endif // IPX_TIMER_H_ 27