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
wholeSecondslongThe mathematical floor of elapsed seconds since the origin.
fractionalSeconduintThe 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
WholeSeconds
Gets the mathematical floor of elapsed seconds since the origin.
public long WholeSeconds { get; }
Property Value
Zero
Gets the simulation origin, also represented by the default value.
public static ChronicleTimestamp Zero { get; }
Property Value
Methods
CompareTo(ChronicleTimestamp)
public int CompareTo(ChronicleTimestamp other)
Parameters
otherChronicleTimestamp
Returns
Equals(ChronicleTimestamp)
public bool Equals(ChronicleTimestamp other)
Parameters
otherChronicleTimestamp
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
Returns a deterministic collection hash of the value's components.
public override int GetHashCode()
Returns
Operators
operator +(ChronicleTimestamp, ChronicleDuration)
Offsets an instant by a signed interval.
public static ChronicleTimestamp operator +(ChronicleTimestamp time, ChronicleDuration delta)
Parameters
timeChronicleTimestampdeltaChronicleDuration
Returns
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
leftChronicleTimestamprightChronicleTimestamp
Returns
operator >(ChronicleTimestamp, ChronicleTimestamp)
Tests whether the left instant is later.
public static bool operator >(ChronicleTimestamp left, ChronicleTimestamp right)
Parameters
leftChronicleTimestamprightChronicleTimestamp
Returns
operator >=(ChronicleTimestamp, ChronicleTimestamp)
Tests whether the left instant is later or equal.
public static bool operator >=(ChronicleTimestamp left, ChronicleTimestamp right)
Parameters
leftChronicleTimestamprightChronicleTimestamp
Returns
operator !=(ChronicleTimestamp, ChronicleTimestamp)
Tests exact inequality.
public static bool operator !=(ChronicleTimestamp left, ChronicleTimestamp right)
Parameters
leftChronicleTimestamprightChronicleTimestamp
Returns
operator <(ChronicleTimestamp, ChronicleTimestamp)
Tests whether the left instant is earlier.
public static bool operator <(ChronicleTimestamp left, ChronicleTimestamp right)
Parameters
leftChronicleTimestamprightChronicleTimestamp
Returns
operator <=(ChronicleTimestamp, ChronicleTimestamp)
Tests whether the left instant is earlier or equal.
public static bool operator <=(ChronicleTimestamp left, ChronicleTimestamp right)
Parameters
leftChronicleTimestamprightChronicleTimestamp
Returns
operator -(ChronicleTimestamp, ChronicleTimestamp)
Gets the signed interval from the right instant to the left instant.
public static ChronicleDuration operator -(ChronicleTimestamp left, ChronicleTimestamp right)
Parameters
leftChronicleTimestamprightChronicleTimestamp
Returns
Remarks
Either operand order is valid, including across the complete timestamp range.