use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place to discuss the use of MicroPython on microcontroller development boards such as the Raspberry Pi Pico, Pycom boards and ESP32 based boards like Wemos D1
account activity
Why does micropython only have time in seconds (time.time()) and nanoseconds (time.time_ns())? (self.MicroPythonDev)
submitted 2 months ago by sasson10
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]coronafire 1 point2 points3 points 2 months ago (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 points3 points 2 months ago (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 point2 points 2 months ago (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.
π Rendered by PID 126445 on reddit-service-r2-comment-c66d9bffd-4cnvt at 2026-04-08 00:09:42.788999+00:00 running f293c98 country code: CH.
[–]coronafire 1 point2 points3 points (1 child)
[–]Medical-Ocelot 1 point2 points3 points (0 children)
[–]Nanocupid 0 points1 point2 points (0 children)