Table of Contents

Struct ChronicleTimestamp

Namespace
Chronicler.Timing
Assembly
Chronicler.dll

An exact nonnegative instant relative to a simulation origin, with 2^-32-second precision.

public readonly struct ChronicleTimestamp : IEquatable<ChronicleTimestamp>, IComparable<ChronicleTimestamp>
Implements
Inherited Members

Remarks

Values do not carry a world or lifetime identity. The owner must ensure that compared or subtracted timestamps share the same origin and simulation lifetime.

Constructors

ChronicleTimestamp(long, uint)

Creates an instant from nonnegative whole seconds and an unsigned fraction.

public ChronicleTimestamp(long wholeSeconds, uint fractionalSecond)

Parameters

wholeSeconds long

The mathematical floor of elapsed seconds since the origin.

fractionalSecond uint

The nonnegative remainder in units of 2^-32 seconds.

Exceptions

ArgumentOutOfRangeException

Whole seconds are negative.

Properties

FractionalSecond

Gets the nonnegative remainder in units of 2^-32 seconds.

public uint FractionalSecond { get; }

Property Value

uint

WholeSeconds

Gets the mathematical floor of elapsed seconds since the origin.

public long WholeSeconds { get; }

Property Value

long

Zero

Gets the simulation origin, also represented by the default value.

public static ChronicleTimestamp Zero { get; }

Property Value

ChronicleTimestamp

Methods

CompareTo(ChronicleTimestamp)

public int CompareTo(ChronicleTimestamp other)

Parameters

other ChronicleTimestamp

Returns

int

Equals(ChronicleTimestamp)

public bool Equals(ChronicleTimestamp other)

Parameters

other ChronicleTimestamp

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

Returns a deterministic collection hash of the value's components.

public override int GetHashCode()

Returns

int

Operators

operator +(ChronicleTimestamp, ChronicleDuration)

Offsets an instant by a signed interval.

public static ChronicleTimestamp operator +(ChronicleTimestamp time, ChronicleDuration delta)

Parameters

time ChronicleTimestamp
delta ChronicleDuration

Returns

ChronicleTimestamp

Exceptions

OverflowException

The result precedes the origin or exceeds the timestamp range.

operator ==(ChronicleTimestamp, ChronicleTimestamp)

Tests exact equality.

public static bool operator ==(ChronicleTimestamp left, ChronicleTimestamp right)

Parameters

left ChronicleTimestamp
right ChronicleTimestamp

Returns

bool

operator >(ChronicleTimestamp, ChronicleTimestamp)

Tests whether the left instant is later.

public static bool operator >(ChronicleTimestamp left, ChronicleTimestamp right)

Parameters

left ChronicleTimestamp
right ChronicleTimestamp

Returns

bool

operator >=(ChronicleTimestamp, ChronicleTimestamp)

Tests whether the left instant is later or equal.

public static bool operator >=(ChronicleTimestamp left, ChronicleTimestamp right)

Parameters

left ChronicleTimestamp
right ChronicleTimestamp

Returns

bool

operator !=(ChronicleTimestamp, ChronicleTimestamp)

Tests exact inequality.

public static bool operator !=(ChronicleTimestamp left, ChronicleTimestamp right)

Parameters

left ChronicleTimestamp
right ChronicleTimestamp

Returns

bool

operator <(ChronicleTimestamp, ChronicleTimestamp)

Tests whether the left instant is earlier.

public static bool operator <(ChronicleTimestamp left, ChronicleTimestamp right)

Parameters

left ChronicleTimestamp
right ChronicleTimestamp

Returns

bool

operator <=(ChronicleTimestamp, ChronicleTimestamp)

Tests whether the left instant is earlier or equal.

public static bool operator <=(ChronicleTimestamp left, ChronicleTimestamp right)

Parameters

left ChronicleTimestamp
right ChronicleTimestamp

Returns

bool

operator -(ChronicleTimestamp, ChronicleTimestamp)

Gets the signed interval from the right instant to the left instant.

public static ChronicleDuration operator -(ChronicleTimestamp left, ChronicleTimestamp right)

Parameters

left ChronicleTimestamp
right ChronicleTimestamp

Returns

ChronicleDuration

Remarks

Either operand order is valid, including across the complete timestamp range.