adafruit / Adafruit_CircuitPython_MiniMQTT

MQTT Client Library for CircuitPython
Other
72 stars 50 forks source link

use time.monotonic_ns() when available #182

Closed vladak closed 7 months ago

vladak commented 8 months ago

This change will use time.monotonic_ns() if available to provide monotonic time based counter with consistent precision in order to be able to work for longer periods of time. On systems that lack this API the __init__() init will throw MMQTTException unless the use_imprecise_time is set to True to avoid unpleasant surprises when running for days on end.

At this stage this is being offered for discussion. Once an approach is found suitable, I will perform testing on HW.

vladak commented 8 months ago

Casually tested on Adafruit CircuitPython 8.2.6 on 2023-09-12; Adafruit QT Py ESP32-S3 no psram with ESP32S3 by calling loop(1) in an infinite cycle after subscribing to a wildcard topic. Set the logger to one with debug level to observe PING messages etc.