Skip to content

Software Timers

This module contain the timer() to handle time and timed events

now

now()

Return the number of milliseconds since the start of the program.

timer

timer()

Creates a new timer.

one_shot

one_shot(delay, fun, arg=None)

Activates the timer in one shot mode. Function fun(arg) is executed only once after delay milliseconds.

interval

interval(period, fun, arg=None)

Activates the timer in interval mode. Function fun(arg) is executed every period milliseconds.

clear

clear()

Disable the timer.

destroy

destroy()

Disable the timer and kills it.

start

start()

Start the timer. A started timer begins counting the number of passing milliseconds. Such number can be read by calling timer.get().

reset

reset()

Reset the timer. A reset timer restarts counting the number of passing milliseconds from zero.

Returns the number of milliseconds passed since the start or the last reset.

get

get()

Return the number of milliseconds passed since the start or the last reset.