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 | |
parent | 65c6abee249bfb7e2d50e4f734d93f422118cb61 (diff) |
using monotonic time
Diffstat (limited to 'kvmd/plugins')
-rw-r--r-- | kvmd/plugins/hid/spi.py | 8 | ||||
-rw-r--r-- | kvmd/plugins/msd/otg/__init__.py | 2 |
2 files changed, 5 insertions, 5 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: diff --git a/kvmd/plugins/msd/otg/__init__.py b/kvmd/plugins/msd/otg/__init__.py index f55dcb42..a4fd3919 100644 --- a/kvmd/plugins/msd/otg/__init__.py +++ b/kvmd/plugins/msd/otg/__init__.py @@ -328,7 +328,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes assert self.__new_file await aiofs.afile_write_now(self.__new_file, chunk) self.__new_file_written += len(chunk) - now = time.time() + now = time.monotonic() if self.__new_file_tick + 1 < now: # Это нужно для ручного оповещения о свободном пространстве на диске, см. get_state() self.__new_file_tick = now |