diff --git a/src/event_manager.cc b/src/event_manager.cc index 4f944b5d..f670ada5 100644 --- a/src/event_manager.cc +++ b/src/event_manager.cc @@ -60,9 +60,9 @@ void EventManager::handle_next_events() if (timer->next_date() <= next_timer) next_timer = timer->next_date(); } - auto timeout = std::chrono::duration_cast(next_timer - Clock::now()); - - poll(events.data(), events.size(), std::max(0, (int)timeout.count())); + using namespace std::chrono; + auto timeout = duration_cast(next_timer - Clock::now()).count(); + poll(events.data(), events.size(), timeout < INT_MAX ? (int)timeout : INT_MAX); for (size_t i = 0; i < events.size(); ++i) { auto& event = events[i];