diff options
author | Devaev Maxim <[email protected]> | 2020-11-13 12:31:00 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-11-13 12:31:00 +0300 |
commit | 58f60bb49f582fba5ac0810c07642e9313b33bfb (patch) | |
tree | ea0cbf9de9f1d8eeb0450d62014091db451a2dec /kvmd/plugins/hid/spi.py | |
parent | 65c6abee249bfb7e2d50e4f734d93f422118cb61 (diff) |
using monotonic time
Diffstat (limited to 'kvmd/plugins/hid/spi.py')
-rw-r--r-- | kvmd/plugins/hid/spi.py | 8 |
1 files changed, 4 insertions, 4 deletions
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: |