Class WorldClockReading
The world clock row as one statement read it, with the database clock it was read against.
public sealed class WorldClockReading
- Inheritance
-
WorldClockReading
- Inherited Members
Remarks
WorldMsNow was computed inside the statement, against the same database clock that stamped BaseReferenceMs, so it does not carry the reader's clock skew. A reader that wants to keep the clock moving locally anchors WorldMsNow on its own monotonic clock the moment the reply arrives and advances it at Rate; it must not subtract its own wall clock from BaseReferenceMs.
When Exists is false, no scene server has seeded the row yet. Only DbNowMs is meaningful then; every other field is zero or null.
Constructors
WorldClockReading(bool, long, long, long, double, double, long, long, string?, DateTime?, long, long?, double?)
Creates a reading. Used by the service; a caller has no reason to build one.
public WorldClockReading(bool exists, long dbNowMs, long baseWorldMs, long baseReferenceMs, double rate, double resumeRate, long epochUnixSeconds, long revision, string? updatedBy, DateTime? updatedAt, long worldMsNow, long? replacedWorldMs = null, double? replacedRate = null)
Parameters
existsbooldbNowMslongbaseWorldMslongbaseReferenceMslongratedoubleresumeRatedoubleepochUnixSecondslongrevisionlongupdatedBystringupdatedAtDateTime?worldMsNowlongreplacedWorldMslong?replacedRatedouble?
Properties
BaseReferenceMs
Database Unix milliseconds when the base was written.
public long BaseReferenceMs { get; }
Property Value
BaseWorldMs
World milliseconds since the calendar epoch at BaseReferenceMs.
public long BaseWorldMs { get; }
Property Value
DbNowMs
The database clock, Unix milliseconds, as the statement read it.
public long DbNowMs { get; }
Property Value
EpochUnixSeconds
The calendar epoch, Unix seconds. World timestamp = this instant + world ms.
public long EpochUnixSeconds { get; }
Property Value
Exists
Whether the row exists. False until a scene server has seeded it.
public bool Exists { get; }
Property Value
IsHeld
Whether the clock is held (pace zero).
public bool IsHeld { get; }
Property Value
Rate
World seconds per real second: 0 held, 1 real time, above 1 raced.
public double Rate { get; }
Property Value
ReplacedRate
On the reading a write returns: the pace the write replaced. Null as for ReplacedWorldMs.
public double? ReplacedRate { get; }
Property Value
ReplacedWorldMs
On the reading a WRITE returns: the world time the write replaced, at the same database instant as DbNowMs. Null on a plain read, and on a write that was a replay (its first attempt committed, the reply was lost, and the retry found its own idempotency key on the row — the write happened exactly once, and what it replaced is no longer known).
public long? ReplacedWorldMs { get; }
Property Value
- long?
ResumeRate
The pace a resume returns to.
public double ResumeRate { get; }
Property Value
Revision
Incremented on every write; a new revision is adopted as an instant jump.
public long Revision { get; }
Property Value
UpdatedAt
UTC time of the last write, by the database clock; null for the seed.
public DateTime? UpdatedAt { get; }
Property Value
UpdatedBy
Account that made the last write; null for the seed.
public string? UpdatedBy { get; }
Property Value
WorldMsNow
World milliseconds since the epoch at DbNowMs: base_world_ms + rate × max(0, db_now_ms − base_reference_ms), floored.
public long WorldMsNow { get; }
Property Value
Methods
Missing(long)
A reading of a database that has no world clock row yet.
public static WorldClockReading Missing(long dbNowMs)
Parameters
dbNowMslong