Table of Contents

Struct GameInstant

Namespace
Shard.Gameplay.Universe.World
Assembly
Shard.Gameplay.Universe.dll

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

epochSeconds long
nanosecondAdjustment long

Fields

NanosecondsPerSecond

public const long NanosecondsPerSecond = 1000000000

Field Value

long

Properties

EpochSeconds

public long EpochSeconds { get; }

Property Value

long

MaximumGameTime

public static GameInstant MaximumGameTime { get; }

Property Value

GameInstant

Nanoseconds

public int Nanoseconds { get; }

Property Value

int

UnixEpoch

public static GameInstant UnixEpoch { get; }

Property Value

GameInstant

ZeroYear

Start of the supported game calendar, 0001-01-01T00:00:00Z.

public static GameInstant ZeroYear { get; }

Property Value

GameInstant

Methods

AddNanoseconds(Int128)

public GameInstant AddNanoseconds(Int128 nanoseconds)

Parameters

nanoseconds Int128

Returns

GameInstant

AddNanoseconds(long)

public GameInstant AddNanoseconds(long nanoseconds)

Parameters

nanoseconds long

Returns

GameInstant

AddSeconds(long)

public GameInstant AddSeconds(long seconds)

Parameters

seconds long

Returns

GameInstant

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

other GameInstant

An 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 other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

FromDateTimeOffset(DateTimeOffset)

public static GameInstant FromDateTimeOffset(DateTimeOffset value)

Parameters

value DateTimeOffset

Returns

GameInstant

NanosecondsSince(GameInstant)

public Int128 NanosecondsSince(GameInstant origin)

Parameters

origin GameInstant

Returns

Int128

ToDateTimeOffset()

public DateTimeOffset ToDateTimeOffset()

Returns

DateTimeOffset

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

left GameInstant
right GameInstant

Returns

bool

operator >=(GameInstant, GameInstant)

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

Parameters

left GameInstant
right GameInstant

Returns

bool

operator <(GameInstant, GameInstant)

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

Parameters

left GameInstant
right GameInstant

Returns

bool

operator <=(GameInstant, GameInstant)

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

Parameters

left GameInstant
right GameInstant

Returns

bool