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

raise an OverflowError like micropython for too big a value #11

Merged
merged 5 commits into from
Aug 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion adafruit_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ def ticks_ms() -> int:

def ticks_add(ticks: int, delta: int) -> int:
"Add a delta to a base number of ticks, performing wraparound at 2**29ms."
return (ticks + delta) % _TICKS_PERIOD
if -_TICKS_HALFPERIOD < delta < _TICKS_HALFPERIOD:
return (ticks + delta) % _TICKS_PERIOD
raise OverflowError("ticks interval overflow")


def ticks_diff(ticks1: int, ticks2: int) -> int:
Expand Down