Explorar o código

CEventLoop: Don't call gettimeofday() at all if there are no timers.

Andreas Kling %!s(int64=6) %!d(string=hai) anos
pai
achega
3b986da643
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      LibCore/CEventLoop.cpp

+ 2 - 1
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;