Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Go to the documentation of this file. 70 virtual ~Timer() =
default;
117 template <
class duration_t = std::chrono::milliseconds>
118 typename duration_t::rep
count()
const;
133 reference_(
std::chrono::steady_clock::now()),
134 accumulated_(
std::chrono::
duration<long double>(0)) {
144 accumulated_ = std::chrono::duration<long double>(0);
145 reference_ = std::chrono::steady_clock::now();
146 }
else if (paused_) {
147 reference_ = std::chrono::steady_clock::now();
153 if (started_ && !paused_) {
155 accumulated_ = accumulated_ + std::chrono::duration_cast< std::chrono::duration<long double> >(now - reference_);
164 reference_ = std::chrono::steady_clock::now();
165 accumulated_ = std::chrono::duration<long double>(0);
169 template <
class duration_t>
173 return std::chrono::duration_cast<duration_t>(accumulated_).
count();
175 return std::chrono::duration_cast<duration_t>(
176 accumulated_ + (std::chrono::steady_clock::now() - reference_)).count();
179 return duration_t(0).count();
virtual ~Timer()=default
Destructor.
Timer & operator=(const Timer &other)=default
Assignment operator by copy.
This class works as a stopwatch.
std::chrono::steady_clock::time_point reference_
void reset()
Reset the timer.
Timer(bool start=false)
Constructor.
std::chrono::duration< long double > accumulated_
clock::time_point time_point
duration_t::rep count() const
Return the elapsed time.
void stop()
Stop/pause the timer.
void start()
Start/resume the timer.