Commit cd92baae authored by louiz’'s avatar louiz’

Little refactor in timed_events

Also makes the coverage code deterministic
parent 6cb77875
......@@ -32,10 +32,8 @@ bool TimedEvent::is_after(const std::chrono::steady_clock::time_point& time_poin
std::chrono::milliseconds TimedEvent::get_timeout() const
auto now = std::chrono::steady_clock::now();
if (now > this->time_point)
return std::chrono::milliseconds(0);
return std::chrono::duration_cast<std::chrono::milliseconds>(this->time_point - now);
auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(this->time_point - std::chrono::steady_clock::now());
return std::max(diff, 0ms);
void TimedEvent::execute() const
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment