Esc

zoned

procedureextensionsince 0.36.1Source
  • macOS: zoned works on macOS
  • Linux: zoned works on Linux
  • Windows: zoned works on Windows
  • Wasm: zoned works on Wasm

Resolves an instant and borrows its zone; the zone owner must outlive the result.

Signature

zoned :: (instant: Timestamp, zone: Time_Zone) -> Zoned
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);
instant, _ := timestamp_from_seconds(1720000000);
z := zoned(instant, zone);
assert(z.offset.seconds == -14400);

See also