You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Are all time.tick_xxx() functions bound to 30 bits? #178
Looking at time.tick_cpu() and the values returned, it looks like this functions overflows at the 30-bit limit of a MicroPython "small int".
Would this be true for all time.tick_xxx()? If that's the case, it's something we could add to the docs, as they are currently vague.
Activity
microbit-carlos commentedon Apr 3, 2024
Ah, looking at the upstream code it's more clear that this is the case:
https://github.com/micropython/micropython/blob/v1.22.0/extmod/modtime.c#L151-L164
And https://github.com/bbcmicrobit/micropython/blob/v1.1.1/source/extmod/utime_mphal.c#L67-L80.
We can update the micro:bit MicroPython docs for V1 and V2 to reflect this.
dpgeorge commentedon Apr 8, 2024
The wrap around behaviour is documented in the MicroPython docs: https://docs.micropython.org/en/latest/library/time.html#time.ticks_ms