timer

class snippets.timer.Timer

Measure elapsed time using a context.

Example

>>> from snippets.timer import Timer
>>> from time import sleep

>>> with Timer() as timer:
...     sleep(1)
>>> timer.duration
1...
property duration: float

Duration for which the timer was active.