Table of Contents

Class ChronicleClock

Namespace
Chronicler.Timing
Assembly
Chronicler.dll

A host-advanced simulation clock with an exact elapsed timeline and a positive step.

public sealed class ChronicleClock : IRecordable
Inheritance
ChronicleClock
Implements
Inherited Members

Remarks

This clock has no wall-time source or thread synchronization. Its owner controls advancement and invalidates retained work when resetting or restoring a timeline.

Constructors

ChronicleClock(ChronicleDuration)

Creates a clock at frame and time zero.

public ChronicleClock(ChronicleDuration stepDuration)

Parameters

stepDuration ChronicleDuration

Exceptions

ArgumentOutOfRangeException

The step is not positive.

Properties

ElapsedTime

Gets accumulated time, preserving the history of step changes.

public ChronicleTimestamp ElapsedTime { get; }

Property Value

ChronicleTimestamp

FrameCount

Gets the number of completed advances in this timeline.

public long FrameCount { get; }

Property Value

long

StepDuration

Gets the duration added by the next advance.

public ChronicleDuration StepDuration { get; }

Property Value

ChronicleDuration

Methods

Advance()

Advances one frame and one configured step, or leaves all state unchanged.

public void Advance()

Exceptions

InvalidOperationException

The frame counter is exhausted.

OverflowException

The next elapsed timestamp cannot be represented.

GetDeadlineFrame(long)

Gets a future frame without scheduling work; zero selects the current frame.

public long GetDeadlineFrame(long framesFromNow)

Parameters

framesFromNow long

Returns

long

Exceptions

ArgumentOutOfRangeException

The offset is negative.

OverflowException

The deadline exceeds the frame range.

RecordData(IChronicler)

Records this clock or transactionally populates it from schema version one.

public void RecordData(IChronicler chronicler)

Parameters

chronicler IChronicler

Remarks

Failed loading leaves the entire clock unchanged. The owner must quiesce its simulation and invalidate old work before restoring; no host services are reset here.

Exceptions

InvalidOperationException

The schema or frame/elapsed relationship is invalid.

ArgumentOutOfRangeException

The elapsed timestamp is negative or the step is not positive.

Reset()

Starts a new zero-based timeline, preserving the configured step.

public void Reset()

Remarks

The owner must invalidate work associated with the previous timeline.

SetStepDuration(ChronicleDuration)

Changes future steps without changing the frame or accumulated elapsed time.

public void SetStepDuration(ChronicleDuration stepDuration)

Parameters

stepDuration ChronicleDuration

Exceptions

ArgumentOutOfRangeException

The step is not positive.