aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6
diff options
context:
space:
mode:
authorAdrian Herrmann <adrian.herrmann@qt.io>2024-04-19 22:59:19 +0200
committerAdrian Herrmann <adrian.herrmann@qt.io>2024-04-22 15:13:28 +0200
commit94c21428779b5433d84c77d7b42d3652c4228709 (patch)
treef98a7e22ba9007ceb6780d79c41e3536557304b5 /sources/pyside6
parent9de4dee2f697dc88812dfad04ce4054cebf6be61 (diff)
QtAsyncio: Round handle timeouts
Handle timeouts should be rounded up or down instead of only up as happens with a plain int() call. Otherwise, a timeout of e.g. 0.9 would be handled as 0, where 1 would be more appropriate. Pick-to: 6.7 Task-number: PYSIDE-2644 Task-number: PYSIDE-769 Change-Id: I19585010c3e007afb6ae83750e4b6ffc9beb5961 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6')
-rw-r--r--sources/pyside6/PySide6/QtAsyncio/events.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/pyside6/PySide6/QtAsyncio/events.py b/sources/pyside6/PySide6/QtAsyncio/events.py
index cec26ee72..a29e480b7 100644
--- a/sources/pyside6/PySide6/QtAsyncio/events.py
+++ b/sources/pyside6/PySide6/QtAsyncio/events.py
@@ -595,7 +595,8 @@ class QAsyncioTimerHandle(QAsyncioHandle, asyncio.TimerHandle):
QAsyncioHandle.__init__(self, callback, args, loop, context, is_threadsafe)
self._when = when
- self._timeout = int(max(self._when - self._loop.time(), 0) * 1000)
+ time = self._loop.time()
+ self._timeout = round(max(self._when - time, 0) * 1000)
QAsyncioHandle._start(self)