summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvmd/apps/kvmd/snapshoter.py4
-rw-r--r--kvmd/plugins/hid/spi.py8
-rw-r--r--kvmd/plugins/msd/otg/__init__.py2
3 files changed, 7 insertions, 7 deletions
diff --git a/kvmd/apps/kvmd/snapshoter.py b/kvmd/apps/kvmd/snapshoter.py
index d0580861..1f4b4619 100644
--- a/kvmd/apps/kvmd/snapshoter.py
+++ b/kvmd/apps/kvmd/snapshoter.py
@@ -80,9 +80,9 @@ class Snapshoter: # pylint: disable=too-many-instance-attributes
last_snapshot_ts = 0.0
while True:
live = is_live()
- if last_snapshot_ts + (self.__live_interval if live else self.__idle_interval) < time.time():
+ if last_snapshot_ts + (self.__live_interval if live else self.__idle_interval) < time.monotonic():
await self.__take_snapshot(live, notifier)
- last_snapshot_ts = time.time()
+ last_snapshot_ts = time.monotonic()
await asyncio.sleep(min(self.__idle_interval, self.__live_interval))
else:
await aiotools.wait_infinite()
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