| |
- builtins.object
-
- Stopwatch
class Stopwatch(builtins.object) |
|
Models a stopwatch, tracking wallclock time.
Stopwatches can be started (run forwards and backwards), stopped, and read. |
|
Methods defined here:
- __init__(self, running_now=False, running_forward=True, elapsed_prior=0, last_start_time=0)
- Instantiate like Stopwatch()
Stopwatch instance is stopped with 0 elapsed wallclock time.
- __str__(self)
- Returns a string representation for a Stopwatch, such that
s2 = eval(str(s1)) copies the state of s1 at the time of the call
- read(self)
- Returns the elapsed wallclock time in seconds as a float.
Works when the Stopwatch is running and when it is stopped.
- reset(self)
- Stopwatch is now stopped with 0 elapsed wallclock time.
- start(self)
- Stopwatch is now running forwards, accumulating wallclock time.
- start_backwards(self)
- Stopwatch is now running backwards, [un]accumulating wallclock time.
- status(self)
- Returns the status of the Stopwatch: a tuple
(running?, forward?, elapsed) : (bool, bool, float)
- stop(self)
- Stopwatch is now stopped: not accumulating wallclock time.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |