Struct GameInstant
Nanosecond-precision UTC instant used by world simulation and protocol projections.
public readonly record struct GameInstant : IComparable, IComparable<GameInstant>, IEquatable<GameInstant>
- Implements
- Inherited Members
Constructors
GameInstant(long, long)
Creates an instant and normalizes a signed nanosecond adjustment like Java's Instant.
public GameInstant(long epochSeconds, long nanosecondAdjustment)
Parameters
Fields
NanosecondsPerSecond
public const long NanosecondsPerSecond = 1000000000
Field Value
Properties
EpochSeconds
public long EpochSeconds { get; }
Property Value
MaximumGameTime
public static GameInstant MaximumGameTime { get; }
Property Value
Nanoseconds
public int Nanoseconds { get; }
Property Value
UnixEpoch
public static GameInstant UnixEpoch { get; }
Property Value
ZeroYear
Start of the supported game calendar, 0001-01-01T00:00:00Z.
public static GameInstant ZeroYear { get; }
Property Value
Methods
AddNanoseconds(Int128)
public GameInstant AddNanoseconds(Int128 nanoseconds)
Parameters
nanosecondsInt128
Returns
AddNanoseconds(long)
public GameInstant AddNanoseconds(long nanoseconds)
Parameters
nanosecondslong
Returns
AddSeconds(long)
public GameInstant AddSeconds(long seconds)
Parameters
secondslong
Returns
CompareTo(GameInstant)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(GameInstant other)
Parameters
otherGameInstantAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
FromDateTimeOffset(DateTimeOffset)
public static GameInstant FromDateTimeOffset(DateTimeOffset value)
Parameters
valueDateTimeOffset
Returns
NanosecondsSince(GameInstant)
public Int128 NanosecondsSince(GameInstant origin)
Parameters
originGameInstant
Returns
ToDateTimeOffset()
public DateTimeOffset ToDateTimeOffset()
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator >(GameInstant, GameInstant)
public static bool operator >(GameInstant left, GameInstant right)
Parameters
leftGameInstantrightGameInstant
Returns
operator >=(GameInstant, GameInstant)
public static bool operator >=(GameInstant left, GameInstant right)
Parameters
leftGameInstantrightGameInstant
Returns
operator <(GameInstant, GameInstant)
public static bool operator <(GameInstant left, GameInstant right)
Parameters
leftGameInstantrightGameInstant
Returns
operator <=(GameInstant, GameInstant)
public static bool operator <=(GameInstant left, GameInstant right)
Parameters
leftGameInstantrightGameInstant