Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use time.monotonic_ns() when available #182

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

vladak
Copy link
Contributor

@vladak vladak commented Oct 30, 2023

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.

otherwise fall back to time.monotonic() however only if forced

fixes adafruit#176
@vladak
Copy link
Contributor Author

vladak commented Nov 2, 2023

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.

# Conflicts:
#	adafruit_minimqtt/adafruit_minimqtt.py
Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Thanks @vladak!

I tested it successfully on a Fun House Adafruit CircuitPython 9.0.0-alpha.5

@FoamyGuy FoamyGuy merged commit d1e2b7c into adafruit:main Nov 27, 2023
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Nov 28, 2023
Updating https://github.com/adafruit/Adafruit_CircuitPython_HUSB238 to 1.0.1 from 1.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_HUSB238#3 from millercommamatt/patch-2
  > example typo

Updating https://github.com/adafruit/Adafruit_CircuitPython_RFM69 to 2.1.18 from 2.1.17:
  > Merge pull request adafruit/Adafruit_CircuitPython_RFM69#48 from jerryneedell/jerryn_power

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 7.5.3 from 7.4.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#186 from vladak/var_header_vs_bytearray
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#183 from vladak/wait_for_msg_pkt_type
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#182 from vladak/time_monotonic_ns
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#188 from vladak/user_data_public

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants