Skip to content

Timers

Software Timers

This module contain the timer to handle time and timed events

function now

now()

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

class timer

timer()

Creates a new timer.

method 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.

method interval

interval(period, fun, arg=None)

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

method clear

clear()

Disable the timer.

method destroy

destroy()

Disable the timer and kills it.

method start

start()

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

method 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.

method get

get()

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