Bash 5.0 printf TZ ambiguous DST transition handling remains undefined
0 reputation · 04 Jan 2023, 04:34 UTC
Bash 5.0 printf %(%Y-%m-%d)T and DST ambiguity
The goal is to generate reproducible date strings from epoch values using Bash’s printf with the %T format, while respecting the time zone specified via TZ. In practice, ambiguous times that occur during daylight‑saving transitions (e.g., 2026‑03‑27 02:30 in Europe/Paris) can be interpreted as either the earlier or the later offset. Bash 5.0 relies on the host’s tzdata database, but the language standard does not dictate how to resolve such ambiguities.
Older Bash releases (≤4.3) ignore TZ for this format, falling back to the system default, which can lead to inconsistent outputs across platforms. Because tzdata is updated independently, the same script may produce different results on systems with different database versions.
We need to understand the current behavior and whether a deterministic strategy exists for Bash’s date formatting during DST transitions.
Unresolved questions
- How does Bash 5.0 resolve ambiguous DST times when
TZis set? - What fallback, if any, does Bash use when the transition cannot be uniquely mapped?