adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.11k stars 1.22k forks source link

Docs: resolution of timing functions #4909

Open dmcomm opened 3 years ago

dmcomm commented 3 years ago

1290 says the "actual resolution" of time.monotonic_ns is 1ms due to this being the unit at which common_hal_time_monotonic ticks. It appears that time.sleep also has an actual resolution of 1ms. It would help to state this in the docs so that people don't get unrealistic expectations of these functions.

tannewt commented 3 years ago

I'd rather leave it vague so that it can vary by port. sleep should never sleep longer that the time given I think.

dmcomm commented 3 years ago

Makes sense that it could vary by port, and CPython is vague about it too. But in a microcontroller context, it would be nice to have an easy way to find out.