Esc

time_zone_retain

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

Acquires an independent owner; UTC and fixed zones need no reference count.

Signature

time_zone_retain :: (value: Time_Zone) -> Time_Zone
Example↗
zone, _ := time_zone_from_posix("EST5EDT,M3.2.0,M11.1.0");
owned := time_zone_retain(zone);
time_zone_free(*zone);
now_instant, _ := timestamp_from_seconds(1720000000);
assert(offset_at(owned, now_instant).seconds == -14400);
time_zone_free(*owned);

See also