1 #ifndef EUDAQ_INCLUDED_Timer
2 #define EUDAQ_INCLUDED_Timer
4 #include "eudaq/Time.hh"
10 Timer() : m_start(Time::Current()), m_stop(0) {}
13 m_start = Time::Current();
15 void Stop() { m_stop = Time::Current(); }
16 Time Elapsed()
const {
return StopTime() - m_start; }
17 double Seconds()
const {
return Elapsed().Seconds(); }
18 double mSeconds()
const {
return 1e3 * Seconds(); }
19 double uSeconds()
const {
return 1e6 * Seconds(); }
21 Formatted(
const std::string &format = TIME_DEFAULT_FORMAT)
const {
22 return Elapsed().Formatted(format);
26 Time StopTime()
const {
27 return m_stop ==
Time(0) ? Time::Current() : m_stop;
33 #endif // EUDAQ_INCLUDED_Timer