35 template<
typename ResolutionType,
typename ClockType = std::chrono::steady_clock>
40 using point =
typename clock::time_point;
71 return std::exchange(
start_, clock::now());
83 return clock::now() -
start_;
95 auto prev_start =
reset();
96 return start_ - prev_start;
109 template<
typename... OpTimerArgs>
112 o << std::chrono::duration_cast<
typename optimer<OpTimerArgs...>::resolution>(tm.
elapsed()).count();
std::ostream & operator<<(std::ostream &s, const irdya_date &d)
Reports time elapsed at the end of an object scope.
~optimer()
Destructor, which invokes the report callback.
interval lap()
Resets the starting tick and returns the elapsed time.
optimer(report_callback f=report_callback{})
Constructor, which starts the timer.
std::function< void(const optimer &)> report_callback
point start() const
Returns the start time point.
typename clock::duration interval
point reset()
Resets the timer back to zero and returns the previous tick value.
ResolutionType resolution
interval elapsed() const
Returns the elapsed time value.