module timelinelib.timer

Contains the Timer class.

Tests are found here.

class timelinelib.timer.Timer[source]

Bases: object

A general timer that can measure the elapsed time between a start and end time.

The timer function used, depends on os (as in timeit.py Python standard library)

  • On Windows, the best timer is time.clock()

  • On most other platforms the best timer is time.time()

From the Python 3.8 doc: The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead, depending on your requirements, to have well-defined behavior. (Contributed by Matthias Bussonnier in bpo-36895.)

__init__(timer=None)[source]

Initialize self. See help(type(self)) for accurate signature.

start()[source]

Start the timer.

end()[source]

Stop the timer.

property elapsed_ms

Return the elapsed time in milliseconds between start and end.