From 58f60bb49f582fba5ac0810c07642e9313b33bfb Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Fri, 13 Nov 2020 12:31:00 +0300 Subject: using monotonic time --- kvmd/plugins/hid/spi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'kvmd/plugins/hid/spi.py') diff --git a/kvmd/plugins/hid/spi.py b/kvmd/plugins/hid/spi.py index de8d4978..7dadac0e 100644 --- a/kvmd/plugins/hid/spi.py +++ b/kvmd/plugins/hid/spi.py @@ -66,9 +66,9 @@ class _SpiPhyConnection(BasePhyConnection): assert len(request) == 8 assert request[0] == 0x33 - deadline_ts = time.time() + self.__read_timeout + deadline_ts = time.monotonic() + self.__read_timeout dummy = b"\x00" * 8 - while time.time() < deadline_ts: + while time.monotonic() < deadline_ts: if bytes(self.__xfer(dummy)) == dummy: break else: @@ -78,9 +78,9 @@ class _SpiPhyConnection(BasePhyConnection): self.__xfer(request) response: List[int] = [] - deadline_ts = time.time() + self.__read_timeout + deadline_ts = time.monotonic() + self.__read_timeout found = False - while time.time() < deadline_ts: + while time.monotonic() < deadline_ts: for byte in self.__xfer(b"\x00" * (5 - len(response))): if not found: if byte != 0x33: -- cgit v1.2.3