Struct ChronicleDuration
- Namespace
- Chronicler.Timing
- Assembly
- Chronicler.dll
An exact signed interval with 64-bit whole seconds and 32 binary fractional bits.
public readonly struct ChronicleDuration : IEquatable<ChronicleDuration>, IComparable<ChronicleDuration>
- Implements
- Inherited Members
Remarks
Whole seconds are rounded toward negative infinity. Negative one fractional unit is (-1, uint.MaxValue). Arithmetic throws on overflow rather than saturating.
Constructors
ChronicleDuration(long, uint)
Creates an interval from floor seconds and an unsigned fraction.
public ChronicleDuration(long wholeSeconds, uint fractionalSecond)
Parameters
wholeSecondslongThe mathematical floor of the interval in seconds.
fractionalSeconduintThe nonnegative remainder in units of 2^-32 seconds.
Properties
FractionalSecond
Gets the nonnegative remainder in units of 2^-32 seconds.
public uint FractionalSecond { get; }
Property Value
WholeSeconds
Gets the mathematical floor of the interval in seconds.
public long WholeSeconds { get; }
Property Value
Zero
Gets the zero interval, also represented by the default value.
public static ChronicleDuration Zero { get; }
Property Value
Methods
CompareTo(ChronicleDuration)
public int CompareTo(ChronicleDuration other)
Parameters
otherChronicleDuration
Returns
Equals(ChronicleDuration)
public bool Equals(ChronicleDuration other)
Parameters
otherChronicleDuration
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 +(ChronicleDuration, ChronicleDuration)
Adds two exact intervals.
public static ChronicleDuration operator +(ChronicleDuration left, ChronicleDuration right)
Parameters
leftChronicleDurationrightChronicleDuration
Returns
Exceptions
- OverflowException
The final interval is outside the signed whole-second range.
operator ==(ChronicleDuration, ChronicleDuration)
Tests exact equality.
public static bool operator ==(ChronicleDuration left, ChronicleDuration right)
Parameters
leftChronicleDurationrightChronicleDuration
Returns
operator >(ChronicleDuration, ChronicleDuration)
Tests whether the left interval is longer than the right interval.
public static bool operator >(ChronicleDuration left, ChronicleDuration right)
Parameters
leftChronicleDurationrightChronicleDuration
Returns
operator >=(ChronicleDuration, ChronicleDuration)
Tests whether the left interval is longer than or equal to the right interval.
public static bool operator >=(ChronicleDuration left, ChronicleDuration right)
Parameters
leftChronicleDurationrightChronicleDuration
Returns
operator !=(ChronicleDuration, ChronicleDuration)
Tests exact inequality.
public static bool operator !=(ChronicleDuration left, ChronicleDuration right)
Parameters
leftChronicleDurationrightChronicleDuration
Returns
operator <(ChronicleDuration, ChronicleDuration)
Tests whether the left interval is shorter than the right interval.
public static bool operator <(ChronicleDuration left, ChronicleDuration right)
Parameters
leftChronicleDurationrightChronicleDuration
Returns
operator <=(ChronicleDuration, ChronicleDuration)
Tests whether the left interval is shorter than or equal to the right interval.
public static bool operator <=(ChronicleDuration left, ChronicleDuration right)
Parameters
leftChronicleDurationrightChronicleDuration
Returns
operator -(ChronicleDuration, ChronicleDuration)
Subtracts two exact intervals.
public static ChronicleDuration operator -(ChronicleDuration left, ChronicleDuration right)
Parameters
leftChronicleDurationrightChronicleDuration
Returns
Exceptions
- OverflowException
The final interval is outside the signed whole-second range.