57 : mStart(ClockType::now()), mElapsed(0), mPaused(!start)
60 static_assert(std::is_same_v<UnitType, std::chrono::seconds>
61 || std::is_same_v<UnitType, std::chrono::milliseconds>
62 || std::is_same_v<UnitType, std::chrono::microseconds>
63 || std::is_same_v<UnitType, std::chrono::nanoseconds>,
120 if constexpr (std::is_same_v<UnitType, std::chrono::nanoseconds>)
122 return duration().count() * 1e-9;
124 else if constexpr (std::is_same_v<UnitType, std::chrono::microseconds>)
126 return duration().count() * 1e-6;
128 else if constexpr (std::is_same_v<UnitType, std::chrono::milliseconds>)
130 return duration().count() * 1e-3;
132 else if constexpr (std::is_same_v<UnitType, std::chrono::seconds>)
134 return duration().count();
142 if constexpr (std::is_same_v<UnitType, std::chrono::nanoseconds>)
144 return duration().count() * 1e-6;
146 else if constexpr (std::is_same_v<UnitType, std::chrono::microseconds>)
148 return duration().count() * 1e-3;
150 else if constexpr (std::is_same_v<UnitType, std::chrono::milliseconds>)
152 return duration().count();
154 else if constexpr (std::is_same_v<UnitType, std::chrono::seconds>)
156 return duration().count() * 1e+3;
165 if constexpr (std::is_same_v<UnitType, std::chrono::nanoseconds>)
167 return duration().count() * 1e-3;
169 else if constexpr (std::is_same_v<UnitType, std::chrono::microseconds>)
171 return duration().count();
173 else if constexpr (std::is_same_v<UnitType, std::chrono::milliseconds>)
175 return duration().count() * 1e+3;
177 else if constexpr (std::is_same_v<UnitType, std::chrono::seconds>)
179 return duration().count() * 1e+6;
188 if constexpr (std::is_same_v<UnitType, std::chrono::nanoseconds>)
190 return duration().count();
192 else if constexpr (std::is_same_v<UnitType, std::chrono::microseconds>)
194 return duration().count() * 1e+3;
196 else if constexpr (std::is_same_v<UnitType, std::chrono::milliseconds>)
198 return duration().count() * 1e+6;
200 else if constexpr (std::is_same_v<UnitType, std::chrono::seconds>)
202 return duration().count() * 1e+9;
226 const auto h = std::chrono::duration_cast<std::chrono::hours>(t);
227 print_duration_if_non_zero(os, h,
"h ");
230 const auto m = std::chrono::duration_cast<std::chrono::minutes>(t);
231 print_duration_if_non_zero(os, m,
"min ");
234 const auto s = std::chrono::duration_cast<std::chrono::seconds>(t);
235 print_duration_if_non_zero(os, s,
"s ");
238 if constexpr (!std::is_same_v<UnitType, std::chrono::seconds>)
240 const auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(t);
241 print_duration_if_non_zero(os, ms,
"ms ");
244 if constexpr (!std::is_same_v<UnitType, std::chrono::milliseconds>)
246 const auto us = std::chrono::duration_cast<std::chrono::microseconds>(t);
247 print_duration_if_non_zero(os, us,
"us ");
250 if constexpr (!std::is_same_v<UnitType, std::chrono::microseconds>)
252 const auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(t);
253 print_duration_if_non_zero(os, ns,
"ns ");
254 if (us == std::chrono::nanoseconds::zero())
259 else if (us == std::chrono::microseconds::zero())
264 else if (ms == std::chrono::milliseconds::zero())
269 else if (s == std::chrono::seconds::zero())