Timer#

class maize.utilities.utilities.Timer[source]#

Bases: object

Timer with start, pause, and stop functionality.

Examples

>>> t = Timer()
... t.start()
... do_something()
... t.pause()
... do_something_else()
... print(t.stop())
__init__() None[source]#

Methods

__init__()

pause()

Temporarily pause the timer.

start()

Start the timer.

stop()

Stop the timer and return the elapsed time in seconds.

Attributes

elapsed_time

Returns the elapsed time.

running

Returns whether the timer is currently running.

property elapsed_time: timedelta#

Returns the elapsed time.

pause() None[source]#

Temporarily pause the timer.

property running: bool#

Returns whether the timer is currently running.

start() None[source]#

Start the timer.

stop() timedelta[source]#

Stop the timer and return the elapsed time in seconds.