lair.clock.Timer#

class lair.clock.Timer(name=None, text='Elapsed time: {:0.4f} seconds', logger=<built-in function print>)[source]#

Bases: ContextDecorator

Time your code using a class, context manager, or decorator

https://realpython.com/python-timer

Parameters:
logger(*args, sep=' ', end='\n', file=None, flush=False)#

Prints the values to a stream, or to sys.stdout by default.

sep

string inserted between values, default a space.

end

string appended after the last value, default a newline.

file

a file-like object (stream); defaults to the current sys.stdout.

flush

whether to forcibly flush the stream.

exception TimerError[source]#

Bases: Exception

A custom exception used to report errors in use of Timer class

start()[source]#

Start a new timer

Return type:

None

stop()[source]#

Stop the timer, and report the elapsed time

Return type:

float

reset_timers()[source]#

Reset class timers