Use time.monotonic instead of time.time where appropriate (#31780)
This commit is contained in:
parent
fbbb29a6ec
commit
3018e8ff47
8 changed files with 21 additions and 23 deletions
|
@ -1,6 +1,6 @@
|
|||
"""Support for Verisure locks."""
|
||||
import logging
|
||||
from time import sleep, time
|
||||
from time import monotonic, sleep
|
||||
|
||||
from homeassistant.components.lock import LockDevice
|
||||
from homeassistant.const import ATTR_CODE, STATE_LOCKED, STATE_UNLOCKED
|
||||
|
@ -71,7 +71,7 @@ class VerisureDoorlock(LockDevice):
|
|||
|
||||
def update(self):
|
||||
"""Update lock status."""
|
||||
if time() - self._change_timestamp < 10:
|
||||
if monotonic() - self._change_timestamp < 10:
|
||||
return
|
||||
hub.update_overview()
|
||||
status = hub.get_first(
|
||||
|
@ -131,4 +131,4 @@ class VerisureDoorlock(LockDevice):
|
|||
transaction = hub.session.get_lock_state_transaction(transaction_id)
|
||||
if transaction["result"] == "OK":
|
||||
self._state = state
|
||||
self._change_timestamp = time()
|
||||
self._change_timestamp = monotonic()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue