replace time.monotonic with adafruit_ticks to preserve timing precision #156
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Time monotonic continues to lose precision as uptime gets longer. This will cause spurious timeouts to occur after a few days depending on the duration of the socket timeout (e.g. 100msec), but will cause spurious timeouts even at 1sec if the uptime gets long enough. I've replaced all of the time.monotonics with adafruit_ticks.ticks_ms and the appropriate tick_diff math to compare with timeouts. This could also be fixed by using time.monotonic_ns as long as the nanosecond ints were subtracted from each other first before being divided into float seconds. Closes #152