Browse Source

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

Andreas Kling 6 years ago
parent
commit
3b986da643
1 changed files with 2 additions and 1 deletions
  1. 2 1
      LibCore/CEventLoop.cpp

+ 2 - 1
LibCore/CEventLoop.cpp

@@ -171,7 +171,8 @@ void CEventLoop::wait_for_event()
     }
     }
 
 
     timeval now;
     timeval now;
-    gettimeofday(&now, nullptr);
+    if (!s_timers->is_empty())
+        gettimeofday(&now, nullptr);
 
 
     for (auto& it : *s_timers) {
     for (auto& it : *s_timers) {
         auto& timer = *it.value;
         auto& timer = *it.value;