Files
Yao Zi 0f7562a0f9 tests: timezone: Provide DST rules when setting TZ on POSIX systems (#3542)
POSIX 2024 defines three formats for the TZ environment variable,

1. Implementation defined format which always starts with a colon:
   ":characters".
2. A specifier which fully describes the timezone rule in format
   "stdoffset[dst[offset][,start[/time],end[/time]]]". Note the
   offset and start/end part could be omitted, in which case one hour
   is implied, or it's considered implementation-defined when changing
   to and from Daylight Saving Time occurs.
3. Geographical or special timezone from an implementation-defined
   timezone database.

POSIX 2024 requires the format 1 and 2 to take precedence over format 3.

In tests/test_timezone.cpp, we set TZ to "EST5EDT" or "IST-2IDT".
According to POSIX, "EST5EDT" should be interpreted as

- timezone "EST", which is five hours behind UTC
- corresponding DST timezone is "EDT", which is one hour ahead of
  standard time
- it's implementation-defined when changing to and from DST occurs

The interpretion is similar for TZ="IST-2IDT". Obviously we're hitting
implementation-defined behavior here, which is inconsistent across
platforms, e.g., musl considers DST is always active if both DST start
and end rules are omitted, thus test_timezone.cpp would fail.

Let's also provide DST rules when setting TZ variables to avoid
depending on implementation-defined behavior.

Fixes: b656d1ceec ("Windows utc_minutes_offset(): Fix historical DST accuracy and improve offset calculation speed (~2.5x) (#3508)")

Signed-off-by: Yao Zi <me@ziyao.cc>
2026-02-24 09:07:37 +02:00
..
2024-11-01 11:26:03 +02:00
2023-09-25 16:40:36 +03:00
2023-09-25 16:08:29 +03:00
2023-09-25 16:08:29 +03:00
2025-05-08 14:02:00 +03:00
2023-09-25 16:40:36 +03:00
2025-05-08 14:02:00 +03:00
2023-09-25 16:40:36 +03:00
2025-05-08 20:13:03 +03:00
2025-10-11 15:50:16 +03:00
2025-05-08 14:02:00 +03:00
2025-11-28 18:20:28 +02:00
2025-05-09 13:22:39 +03:00
2023-09-25 16:08:29 +03:00
2023-09-25 16:40:36 +03:00