fix(libc): leave tzname[1] as three spaces for a zone without daylight saving time #8546

Merged
Retr0G28 merged 2 commits from upstream-pr/8546 into main 2026-10-23 18:31:05 +00:00
Retr0G28 commented 2026-10-20 16:07:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Retr0G28 on 2026-10-20T16:07:26Z.


What

tzname[1] for a zone without daylight saving time was empty on Windows and a copy of tzname[0] on Linux. FreeBSD 11 initializes tzname to WILDABBR (three spaces) and settzname in contrib/tzcode/stdtime/localtime.c resets both entries to it before filling them from the zone's types, so a zone with no daylight saving type, such as UTC-5 or EST5, keeps three spaces in tzname[1].

tzname is now filled through one helper: tzname[0] is the host's standard name, and tzname[1] is the host's daylight name when the host zone has daylight saving time (_daylight on Windows, daylight on Linux) and three spaces otherwise. tm_zone and %Z are unchanged, as a broken-down time with tm_isdst 0 never reads tzname[1]. The sentence about this in the tzname entry of docs/dev/debt/libc.md is removed.

guest_time_conversion now checks that tzname[1] is three spaces after tzset and after an implicit TZ change for UTC-5 and EST5; EST5EDT keeps EST and EDT.

Tested

Windows 11, WinLibs MinGW-w64 GCC 15.2.0 r7, CMake + Ninja, Release, -DBUILD_TESTING=ON, rebased on main 47fa6eecf.

  • guest_time_conversion fails on main's Time.cpp with "Implicit guest TZ update did not refresh tzname" (exit 0xc0000409 from the failed Require); with this PR it passes.
  • ctest -R "time|tz|strftime|mktime|libc_static|libc_threads|system_service" -E "^agc_": 41 of 41 pass after the rebase.
  • python tools/check_conventions.py --base origin/main passes.
  • Not tested on Linux. The change reads daylight there, which glibc sets from the zone's current rules, while FreeBSD's settzname takes tzname[1] from any daylight type in the zone file, so a zone that only had daylight saving time in the past may still differ there.
  • No title or homebrew run.

Overlap:

  • #8324 (export timezone and daylight) merged first; this PR is rebased onto it and keeps its timezone and daylight code, changing only the two tzname assignments in tzset_nid_postfix.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4938683611 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8546). Originally posted by [Retr0G28](https://github.com/Retr0G28) on 2026-10-20T16:07:26Z. --- ### What `tzname[1]` for a zone without daylight saving time was empty on Windows and a copy of `tzname[0]` on Linux. FreeBSD 11 initializes `tzname` to `WILDABBR` (three spaces) and `settzname` in `contrib/tzcode/stdtime/localtime.c` resets both entries to it before filling them from the zone's types, so a zone with no daylight saving type, such as `UTC-5` or `EST5`, keeps three spaces in `tzname[1]`. `tzname` is now filled through one helper: `tzname[0]` is the host's standard name, and `tzname[1]` is the host's daylight name when the host zone has daylight saving time (`_daylight` on Windows, `daylight` on Linux) and three spaces otherwise. `tm_zone` and `%Z` are unchanged, as a broken-down time with `tm_isdst` 0 never reads `tzname[1]`. The sentence about this in the tzname entry of `docs/dev/debt/libc.md` is removed. `guest_time_conversion` now checks that `tzname[1]` is three spaces after `tzset` and after an implicit `TZ` change for `UTC-5` and `EST5`; `EST5EDT` keeps `EST` and `EDT`. ### Tested Windows 11, WinLibs MinGW-w64 GCC 15.2.0 r7, CMake + Ninja, Release, `-DBUILD_TESTING=ON`, rebased on `main` 47fa6eecf. - `guest_time_conversion` fails on `main`'s `Time.cpp` with "Implicit guest TZ update did not refresh tzname" (exit 0xc0000409 from the failed `Require`); with this PR it passes. - ctest `-R "time|tz|strftime|mktime|libc_static|libc_threads|system_service" -E "^agc_"`: 41 of 41 pass after the rebase. - `python tools/check_conventions.py --base origin/main` passes. - Not tested on Linux. The change reads `daylight` there, which glibc sets from the zone's current rules, while FreeBSD's `settzname` takes `tzname[1]` from any daylight type in the zone file, so a zone that only had daylight saving time in the past may still differ there. - No title or homebrew run. Overlap: - #8324 (export `timezone` and `daylight`) merged first; this PR is rebased onto it and keeps its `timezone` and `daylight` code, changing only the two `tzname` assignments in `tzset_nid_postfix`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8546
No description provided.