Skip to content

time counter (utime) (utime.vars)

What it does: Returns the value of the selected time function of the utime module (eg ticks).

utime.vars

Inputs

  • no data inputs.
  • Field VARS: selection of a specific time function.

Output

  • numerical time value (Number).

When to use it

  • Interval measurement and non-blocking timing.
  • Comparing timestamps between two events.

Tips and pitfalls

  • To calculate the difference between tick values, use the corresponding functions (eg ticks_diff).
  • Do not rely on the absolute size of the tick value long term, it may overflow.

Generated Python example

import utime
now_ms = utime.ticks_ms()