Skip to content

Commit 9af0e3f

Browse files
committed
reverted func name back to get_monotonic_time to pass build check
1 parent 639160a commit 9af0e3f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def __init__(
220220
self.client_id = client_id
221221
else:
222222
# assign a unique client_id
223-
time_int = (self.get_monotonic_ns_time() % 10000000000) // 10000000
223+
time_int = (self.get_monotonic_time() % 10000000000) // 10000000
224224
self.client_id = f"cpy{randint(0, time_int)}{randint(0, 99)}"
225225
# generated client_id's enforce spec.'s length rules
226226
if len(self.client_id.encode("utf-8")) > 23 or not self.client_id:
@@ -244,7 +244,7 @@ def __init__(
244244
self.on_subscribe = None
245245
self.on_unsubscribe = None
246246

247-
def get_monotonic_ns_time(self) -> float:
247+
def get_monotonic_time(self) -> float:
248248
"""
249249
Provide monotonic time in nanoseconds. Based on underlying implementation
250250
this might result in imprecise time, that will result in the library
@@ -261,7 +261,7 @@ def diff_ns(self, stamp_ns):
261261
Taking timestamp differences using nanosecond ints before dividing
262262
should maintain precision.
263263
"""
264-
return (self.get_monotonic_ns_time() - stamp_ns) / 1000000000
264+
return (self.get_monotonic_time() - stamp_ns) / 1000000000
265265

266266
def __enter__(self):
267267
return self
@@ -534,9 +534,9 @@ def _connect(
534534
if self._username is not None:
535535
self._send_str(self._username)
536536
self._send_str(self._password)
537-
self._last_msg_sent_timestamp_ns = self.get_monotonic_ns_time()
537+
self._last_msg_sent_timestamp_ns = self.get_monotonic_time()
538538
self.logger.debug("Receiving CONNACK packet from broker")
539-
stamp_ns = self.get_monotonic_ns_time()
539+
stamp_ns = self.get_monotonic_time()
540540
while True:
541541
op = self._wait_for_msg()
542542
if op == 32:
@@ -602,7 +602,7 @@ def ping(self) -> list[int]:
602602
self.logger.debug("Sending PINGREQ")
603603
self._sock.send(MQTT_PINGREQ)
604604
ping_timeout = self.keep_alive
605-
stamp_ns = self.get_monotonic_ns_time()
605+
stamp_ns = self.get_monotonic_time()
606606
self._last_msg_sent_timestamp_ns = stamp_ns
607607
rc, rcs = None, []
608608
while rc != MQTT_PINGRESP:
@@ -678,11 +678,11 @@ def publish(
678678
self._sock.send(pub_hdr_fixed)
679679
self._sock.send(pub_hdr_var)
680680
self._sock.send(msg)
681-
self._last_msg_sent_timestamp_ns = self.get_monotonic_ns_time()
681+
self._last_msg_sent_timestamp_ns = self.get_monotonic_time()
682682
if qos == 0 and self.on_publish is not None:
683683
self.on_publish(self, self.user_data, topic, self._pid)
684684
if qos == 1:
685-
stamp_ns = self.get_monotonic_ns_time()
685+
stamp_ns = self.get_monotonic_time()
686686
while True:
687687
op = self._wait_for_msg()
688688
if op == 0x40:
@@ -755,7 +755,7 @@ def subscribe(self, topic: Optional[Union[tuple, str, list]], qos: int = 0) -> N
755755
self.logger.debug(f"SUBSCRIBING to topic {t} with QoS {q}")
756756
self.logger.debug(f"payload: {payload}")
757757
self._sock.send(payload)
758-
stamp_ns = self.get_monotonic_ns_time()
758+
stamp_ns = self.get_monotonic_time()
759759
self._last_msg_sent_timestamp_ns = stamp_ns
760760
while True:
761761
op = self._wait_for_msg()
@@ -832,10 +832,10 @@ def unsubscribe(self, topic: Optional[Union[str, list]]) -> None:
832832
for t in topics:
833833
self.logger.debug(f"UNSUBSCRIBING from topic {t}")
834834
self._sock.send(payload)
835-
self._last_msg_sent_timestamp_ns = self.get_monotonic_ns_time()
835+
self._last_msg_sent_timestamp_ns = self.get_monotonic_time()
836836
self.logger.debug("Waiting for UNSUBACK...")
837837
while True:
838-
stamp_ns = self.get_monotonic_ns_time()
838+
stamp_ns = self.get_monotonic_time()
839839
op = self._wait_for_msg()
840840
if op is None:
841841
if self.diff_ns(stamp_ns) > self._recv_timeout:
@@ -938,7 +938,7 @@ def loop(self, timeout: float = 0) -> Optional[list[int]]:
938938
self._connected()
939939
self.logger.debug(f"waiting for messages for {timeout} seconds")
940940

941-
stamp_ns = self.get_monotonic_ns_time()
941+
stamp_ns = self.get_monotonic_time()
942942
rcs = []
943943

944944
while True:
@@ -1063,7 +1063,7 @@ def _sock_exact_recv(
10631063
:param float timeout: timeout, in seconds. Defaults to keep_alive
10641064
:return: byte array
10651065
"""
1066-
stamp_ns = self.get_monotonic_ns_time()
1066+
stamp_ns = self.get_monotonic_time()
10671067
if not self._backwards_compatible_sock:
10681068
# CPython/Socketpool Impl.
10691069
rc = bytearray(bufsize)

0 commit comments

Comments
 (0)