[pygobject/benzea/gio-asyncio] fixup! events: Implement asyncio event loop based on glib



commit 9d6e3d69ee81e44e7706aa7bac0026b0ef5fa0f5
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Nov 18 11:53:37 2021 +0100

    fixup! events: Implement asyncio event loop based on glib

 gi/events.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gi/events.py b/gi/events.py
index 03dfc6f8..021b1231 100644
--- a/gi/events.py
+++ b/gi/events.py
@@ -115,7 +115,9 @@ class GLibEventLoop(asyncio.SelectorEventLoop):
             return 0
 
         if self._scheduled:
-            timeout = (self._scheduled[0]._when - self.time()) * 1000
+            # The time is floor'ed here.
+            # Python dispatches everything ready within the next _clock_resolution.
+            timeout = int((self._scheduled[0]._when - self.time()) * 1000)
             return timeout if timeout >= 0 else 0
 
         return -1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]