Table of Contents

Class ZonedInstant

Namespace
MailFathom.Domain.Scheduling
Assembly
MailFathom.Domain.dll

One instant, together with the zone whoever named it was thinking in.

public sealed record ZonedInstant : IEquatable<ZonedInstant>
Inheritance
ZonedInstant
Implements
Inherited Members

Remarks

A person names a time in a place rather than as an offset from now: nine in the morning in Warsaw is nine in the morning on both sides of a daylight-saving transition, and the two are different instants. Keeping the zone beside the instant is what lets the instant be read back as the time it was meant to be, and what makes a value stored months before it matters still mean what it meant when it was written.

The instant is the value everything compares, and the zone is never used to re-derive it. Resolution happens once, where the local time is named, so a zone whose rules change afterwards cannot move a decision that was already taken.

Two local times have no single instant and both are resolved here rather than left to whichever arithmetic a caller happens to perform. A time the clock skips over when it springs forward does not occur at all, and is taken as the instant the gap ends, so the occasion still happens rather than being lost. A time the clock passes through twice when it falls back occurs twice, and the first of the two is taken, so the occasion happens once and at the earlier of the two readings.

Fields

CoordinatedZoneId

The name the coordinated zone is recorded under when a local time named none.

MaximumZoneIdLength

The greatest length a zone identifier may have, which bounds the column one is stored in.

Properties

Instant

Gets the instant itself, which is what every comparison is made against.

ZoneId

Gets the zone the instant was named in, as the identifier a system knows it by.

Methods

At(DateTimeOffset)

Names an instant that was already one, in the coordinated zone.

Resolve(DateTime, TimeZoneInfo)

Resolves a wall-clock time in a zone to the instant it names.

Restore(DateTimeOffset, string)

Restores a value from the instant and the zone identifier a record holds.

ToString()

Returns a string that represents the current object.