twisted.internet.task.Clock
class documentationtwisted.internet.task
(View In Hierarchy)
Known subclasses: twisted.internet.test.test_endpoints.RaisingMemoryReactorWithClock, twisted.internet.testing.MemoryReactorClock, twisted.names.test.test_util.MemoryReactor, twisted.pair.test.test_tuntap.FSSetClock, twisted.runner.test.test_procmon.DummyProcessReactor
Implements interfaces: twisted.internet.interfaces.IReactorTime
Provide a deterministic, easily-controlled implementation of IReactorTime.callLater
.
This is commonly useful for writing deterministic unit tests for code which
schedules events using this API.
Method | __init__ | Undocumented |
Method | seconds | Pretend to be time.time(). This is used internally when an operation
such as IDelayedCall.reset
needs to determine a time value relative to the current time. |
Method | callLater | See twisted.internet.interfaces.IReactorTime.callLater . |
Method | getDelayedCalls | See twisted.internet.interfaces.IReactorTime.getDelayedCalls |
Method | advance | Move time on this clock forward by the given amount and run whatever pending calls should be run. |
Method | pump | Advance incrementally by the given set of times. |
Method | _sortCalls | Sort the pending calls according to the time they are scheduled. |
Pretend to be time.time(). This is used internally when an operation
such as IDelayedCall.reset
needs to determine a time value relative to the current time.
Returns | The time which should be considered the current time. (type: float ) |