22 #ifndef GEARS_CHRONO_STOPWATCH_HPP
23 #define GEARS_CHRONO_STOPWATCH_HPP
29 template<
typename Clock>
32 using time_point =
typename Clock::time_point;
33 using duration =
typename Clock::duration;
34 using rep =
typename Clock::rep;
35 using period =
typename Clock::period;
38 duration elapsed_time = duration::zero();
58 elapsed_time += Clock::now() - now;
72 elapsed_time = duration::zero();
90 elapsed_time = duration::zero();
106 template<
typename Duration = std::chrono::milliseconds>
109 return std::chrono::duration_cast<Duration>(elapsed_time + Clock::now() - now).count();
110 return std::chrono::duration_cast<Duration>(elapsed_time).count();
122 using stopwatch = basic_stopwatch<std::chrono::high_resolution_clock>;
167 #endif // GEARS_CHRONO_STOPWATCH_HPP