Esc

Disambiguation

enumextensionsince 0.36.1Source
  • macOS: Disambiguation works on macOS
  • Linux: Disambiguation works on Linux
  • Windows: Disambiguation works on Windows
  • Wasm: Disambiguation works on Wasm

Declaration

Disambiguation :: enum u8 {
    COMPATIBLE;    EARLIER;    LATER;    REJECT;}

Resolves skipped/repeated civil times; e.g. .REJECT fails for either ambiguity. COMPATIBLE chooses later in a gap and earlier in a fold.

Example↗
zone, zone_error := time_zone_from_posix("EST5EDT,M3.2.0,M11.1.0");
assert(zone_error.kind == .NONE);
defer time_zone_free(*zone);
gap := Date_Time.{ .{ 2024, 3, 10 }, .{ 2, 30, 0, 0 } };
earlier, _ := to_timestamp(zone, gap, .EARLIER);
later, _ := to_timestamp(zone, gap, .LATER);
assert(later.seconds - earlier.seconds == 3600);
_, rejected := to_timestamp(zone, gap, .REJECT);
assert(rejected.kind == .GAP);

See also