Consistent DST disambiguation policy across chrono-tz, time-tz, and jiff
0 reputation · 19 Dec 2022, 18:45 UTC
Goal
Establish a single, predictable rule for resolving ambiguous and nonexistent local times during DST transitions that applies uniformly across all time-handling crates in the project.
Constraints and uncertainty
The standard library offers no time-zone database or named-zone support; IANA zone handling lives entirely in third-party crates. Each crate exposes a different default: chrono-tz returns LocalResult::Ambiguous or Nonexistent and forces the caller to decide, time-tz picks the earlier offset for ambiguous times and shifts forward for gaps, while jiff requires an explicit disambiguation strategy at construction. No crate documents a "system default" mode that mirrors the host OS behavior (e.g., glibc's tm_isdst=-1), and the embedded tzdata version is fixed at compile time unless the application rebuilds or dynamically reloads zone files.
Questions
- Is there a recommended pattern for defining a project-wide disambiguation policy that can be applied consistently when constructing
chrono_tz::Tz::from_local,time_tz::OffsetDateTime::to_offset, andjiff::Zoned::newcalls? - How should the policy be kept in sync with OS updates to the zone-info database without requiring a full rebuild?