Table of Contents

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

wholeSeconds long

The mathematical floor of the interval in seconds.

fractionalSecond uint

The 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

uint

WholeSeconds

Gets the mathematical floor of the interval in seconds.

public long WholeSeconds { get; }

Property Value

long

Zero

Gets the zero interval, also represented by the default value.

public static ChronicleDuration Zero { get; }

Property Value

ChronicleDuration

Methods

CompareTo(ChronicleDuration)

public int CompareTo(ChronicleDuration other)

Parameters

other ChronicleDuration

Returns

int

Equals(ChronicleDuration)

public bool Equals(ChronicleDuration other)

Parameters

other ChronicleDuration

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 +(ChronicleDuration, ChronicleDuration)

Adds two exact intervals.

public static ChronicleDuration operator +(ChronicleDuration left, ChronicleDuration right)

Parameters

left ChronicleDuration
right ChronicleDuration

Returns

ChronicleDuration

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

left ChronicleDuration
right ChronicleDuration

Returns

bool

operator >(ChronicleDuration, ChronicleDuration)

Tests whether the left interval is longer than the right interval.

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

Parameters

left ChronicleDuration
right ChronicleDuration

Returns

bool

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

left ChronicleDuration
right ChronicleDuration

Returns

bool

operator !=(ChronicleDuration, ChronicleDuration)

Tests exact inequality.

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

Parameters

left ChronicleDuration
right ChronicleDuration

Returns

bool

operator <(ChronicleDuration, ChronicleDuration)

Tests whether the left interval is shorter than the right interval.

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

Parameters

left ChronicleDuration
right ChronicleDuration

Returns

bool

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

left ChronicleDuration
right ChronicleDuration

Returns

bool

operator -(ChronicleDuration, ChronicleDuration)

Subtracts two exact intervals.

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

Parameters

left ChronicleDuration
right ChronicleDuration

Returns

ChronicleDuration

Exceptions

OverflowException

The final interval is outside the signed whole-second range.