Esc

time_zone_get

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

Loads and caches a safe IANA name; directory overrides TZDIR for deterministic fixtures.

Signature

time_zone_get :: (
    name: string,
    options: Time_Options = .{},
    directory: string = ""
) -> (Time_Zone, Time_Error)
Example↗
zone, error := time_zone_get("America/New_York");
assert(error.kind == .NONE);
defer time_zone_free(*zone);
instant, _ := timestamp_from_seconds(1720000000);
assert(offset_at(zone, instant).seconds == -14400);

See also