From 3b986da6431bf566fbf75c37e9a040ab3f9d024d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 18 Apr 2019 13:23:59 +0200 Subject: [PATCH] CEventLoop: Don't call gettimeofday() at all if there are no timers. --- LibCore/CEventLoop.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LibCore/CEventLoop.cpp b/LibCore/CEventLoop.cpp index 7fccd26109..0b6e426821 100644 --- a/LibCore/CEventLoop.cpp +++ b/LibCore/CEventLoop.cpp @@ -171,7 +171,8 @@ void CEventLoop::wait_for_event() } timeval now; - gettimeofday(&now, nullptr); + if (!s_timers->is_empty()) + gettimeofday(&now, nullptr); for (auto& it : *s_timers) { auto& timer = *it.value;