clockblocks.scheduler.CompressedTime

class clockblocks.scheduler.CompressedTime(factor: float = 10.0)[source]

Bases: TimingBackend

A TimingBackend that runs scaled real time: now() advances factor times faster and the sleep condition’s wait() divides its timeout by factor. A clock family on this backend runs deterministically fast while cross-thread handshakes still happen as usual.

Caveat: handshake / context-switch overhead is not compressed, so a T-second wait costs roughly T / factor + handshake_overhead. Very large factors hit that floor and loosen achievable timing tolerances (see tests/README.md). 10x is a good default.

Methods

get_sleep_condition()

A condition whose wait() shortens any timeout by factor, so that sleeps in compressed time take correspondingly less real time.

now()

Real time since this backend was created, scaled up by factor.

now() → float[source]

Real time since this backend was created, scaled up by factor.

get_sleep_condition() → Condition[source]

A condition whose wait() shortens any timeout by factor, so that sleeps in compressed time take correspondingly less real time.