Table of Contents

Event ClockEvents

Namespace
KZDev.SystemClock.PrimeTime.Testing
Assembly
KZDev.SystemClock.PrimeTime.Testing.dll

Occurs when the clock publishes a discriminated lifecycle or virtual-time event.

event PrimeTestClockEventHandler? ClockEvents

Returns

PrimeTestClockEventHandler
Occurs when the clock publishes a discriminated lifecycle or virtual-time event.

Remarks

Subscribers receive PrimeTestClockEvent payloads and distinguish kinds via EventType or derived types (PrimeTestClockNewTimeEvent, PrimeTestClockStartedEvent, PrimeTestClockStoppedEvent).

New-time cadence. During forward Advance(TimeSpan), forward SetTime(DateTimeOffset), persist-on-read, or automatic runner marching, NewTime is raised once per distinct virtual instant visited. While Start(TimeSpan?) is active, if one full virtual minute passes without another virtual-time-driving event, the runner raises NewTime for that heartbeat instant and resets the one-minute window when substantive work occurs. Permitted backward SetTime(DateTimeOffset) while stopped raises NewTime once for the new instant without per-instant march raises.

Lifecycle. ClockStarted is raised only on a stopped-to-running transition from Start(TimeSpan?) (not when already running). ClockStopped is raised only when Stop() stops a running clock, after the runner thread joins and the final virtual instant is committed.

Rate on timed events. RunRateTimeSpan and, in the Noda package, RunRateDuration on timed event types reflect the active runner rate when IsRunning is true; they are null when the clock is stopped (including on NewTime while stopped).

Subscriber exceptions. Handler exceptions propagate to the code that raised the event. The first throwing handler prevents later handlers from running. Events raised while the automatic runner is active are delivered on the runner thread, so an unhandled exception can abort in-progress virtual-time work or end the runner thread.