hio.help.timing
hio.help.timing module
Module Contents
Classes
Class to manage real elaspsed time using time module. |
|
Class to manage real elaspsed time using time module but with monotonically |
- exception hio.help.timing.TimerError[source]
Bases:
hio.hioing.HioErrorGeneric Timer Errors Usage:
raise TimerError(“error message”)
- exception hio.help.timing.RetroTimerError[source]
Bases:
TimerErrorError due to real time being retrograded before start time of timer Usage:
raise RetroTimerError(“error message”)
- class hio.help.timing.Timer(duration=0.0, start=None, **kwa)[source]
Bases:
hio.hioing.MixinClass to manage real elaspsed time using time module. .. attribute:: ._start is start tyme in seconds
- ._stop is stop tyme in seconds
- Properties:
.duration is float time duration in seconds of timer from ._start to ._stop .elaspsed is float time elasped in seconds since ._start .remaining is float time remaining in seconds until ._stop .expired is boolean, True if expired, False otherwise, i.e. time >= ._stop
- .start() start timer at current time
- .restart() = restart timer at last ._stop so no time lost
- property duration(self)[source]
duration property getter, .duration = ._stop - ._start .duration is float duration tyme
- property elapsed(self)[source]
elapsed time property getter, Returns elapsed time in seconds (fractional) since ._start.
- property remaining(self)[source]
remaining time property getter, Returns remaining time in seconds (fractional) before ._stop.
- property expired(self)[source]
Returns True if timer has expired, False otherwise. time.time() >= ._stop,
- class hio.help.timing.MonoTimer(duration=0.0, start=None, retro=True)[source]
Bases:
TimerClass to manage real elaspsed time using time module but with monotonically increating time guarantee in spite of system time being retrograded.
If the system clock is retrograded (moved back in time) while the timer is running then time.time() could move to before the start time. MonoTimer detects this retrograde and if retro is True then retrogrades the start and stop times back Otherwise it raises a TimerRetroError. MonoTimer is not able to detect a prograded clock (moved forward in time)
- ._start is start time in seconds
- ._stop is stop time in seconds
- ._last is last measured time in seconds with retrograde handling
- .retro is boolean If True retrograde ._start and ._stop when time is retrograded.
- Properties:
.duration is float time duration in seconds of timer from ._start to ._stop .elaspsed is float time elasped in seconds since ._start .remaining is float time remaining in seconds until ._stop .expired is boolean True if expired, False otherwise, i.e. time >= ._stop .latest is float latest measured time in seconds with retrograte handling
- .start() = start timer at current time returns start time
- .restart() = restart timer at last ._stop so no time lost, returns start time
- property elapsed(self)[source]
elapsed time property getter, Returns elapsed time in seconds (fractional) since ._start.
- property remaining(self)[source]
remaining time property getter, Returns remaining time in seconds (fractional) before ._stop.