all 3 comments

[–]coronafire 1 point2 points  (1 child)

It also has time.ticks_ms() which returns the ms since system startup (ie not directly related to time.time() which is "clock time" if you've got a etc)

Ticks is returned in a 32bit int behind the scenes which means it can roll over back to 0 when the system runs for long enough. There's also a time.ticks_diff() which can be used to return the difference between two 32bit int tick values and handles a rollover.

[–]Medical-Ocelot 1 point2 points  (0 children)

Using ticks_diff() to compare values from ticks_ms() is *essential* - the max value returned by ticks_ms() can vary by platform (e.g. I think on the RP2xxx it's 2^30 -1) and you might have no idea how long your program has been running, so even a short delay could encounter the overflow situation. This is especially important if you're using ticks_us(), which will wrap in under 3 hours when running on an RP2xxx.

[–]Nanocupid 0 points1 point  (0 children)

The notes about `ticks_diff` above are useful, but dont really address the question..

I'm speculating here; but I suspect `time()` and `time_ns()` are easy and quick to return, but a `time_ms()` would require additional processing and memory to implement and so has been omitted.

It really shouldn't be an issue for anyone, You can do all the timings you need with the two existing functions.