Module clock¶
-
class
sismic.clock.
Clock
¶ Bases:
object
Abstract implementation of a clock, as used by an interpreter.
The purpose of a clock instance is to provide a way for the interpreter to get the current time during the execution of a statechart.
-
class
sismic.clock.
SimulatedClock
¶ Bases:
sismic.clock.clock.Clock
A simulated clock, starting from 0, that can be manually or automatically incremented.
Manual incrementation can be done by setting a new value to the time attribute. Automatic incrementation occurs when start() is called, until stop() is called. In that case, clock speed can be adjusted with the speed attribute. A value strictly greater than 1 increases clock speed while a value strictly lower than 1 slows down the clock.
-
start
()¶ Clock will be automatically updated both based on real time and its speed attribute.
Return type: None
-
stop
()¶ Clock won’t be automatically updated.
Return type: None
-
-
class
sismic.clock.
UtcClock
¶ Bases:
sismic.clock.clock.Clock
A clock that simulates a wall clock in UTC.
The returned time value is based on Python time.time() function.
-
class
sismic.clock.
SynchronizedClock
(interpreter)¶ Bases:
sismic.clock.clock.Clock
A clock that is synchronized with a given interpreter.
The synchronization is based on the interpreter’s internal time value, not on its clock. As a consequence, the time value of a SynchronizedClock only changes when the underlying interpreter is executed.
Parameters: interpreter – an interpreter instance