feat(libc): implement tzset #3124

Merged
babyhuey merged 1 commit from upstream-pr/3124 into main 2026-10-10 22:43:55 +00:00
babyhuey commented 2026-10-10 22:38:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T22:38:29Z.


What

Implements tzset (gYFKAMoNEfo) in libc. It calls the host's tzset (_tzset on Windows), so a guest that changes TZ and calls tzset gets the new zone from localtime and the other conversions, which already go through the host time zone.

PS5MC (PPSA99420) stops at it on main f38a036e (catalog build, eboot.bin and sce_module/libc.prx unwrapped as #2605 requires, with #1529 in; tracked in #1578):

  • main, Linux: app.elf: symbol lookup error: app.elf: undefined symbol: gYFKAMoNEfo
  • with this PR, Linux: app.elf: symbol lookup error: app.elf: undefined symbol: 0NJDcQ2B8vE (execvp, #2827)

Tested

Linux (Ubuntu 24.04, GCC 13, Release) on f38a036e: guest_time_conversion passes 5/5 (--repeat until-fail:5). The new case switches TZ from UTC-2 to UTC-5, calls tzset, and checks that the epoch converts to 05:00 with tm_gmtoff 18000; it fails if tzset doesn't re-read TZ. check_conventions.py passes. Windows 11 (MinGW-w64 GCC 15.2 from WinLibs, Release): guest_time_conversion 5/5 with no warnings, so the UTC-5 case passes through _tzset too. The Windows loader reports FAIL: unresolved ELF import 0NJDcQ2B8vE (execvp) from libkernel.prx first for PS5MC, on main and with this PR, so it reaches tzset there only once #2827 is in.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4814940182 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3124). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-10T22:38:29Z. --- ### What Implements `tzset` (`gYFKAMoNEfo`) in libc. It calls the host's `tzset` (`_tzset` on Windows), so a guest that changes `TZ` and calls `tzset` gets the new zone from `localtime` and the other conversions, which already go through the host time zone. PS5MC (PPSA99420) stops at it on `main` f38a036e (catalog build, `eboot.bin` and `sce_module/libc.prx` unwrapped as #2605 requires, with #1529 in; tracked in #1578): - `main`, Linux: `app.elf: symbol lookup error: app.elf: undefined symbol: gYFKAMoNEfo` - with this PR, Linux: `app.elf: symbol lookup error: app.elf: undefined symbol: 0NJDcQ2B8vE` (`execvp`, #2827) ### Tested Linux (Ubuntu 24.04, GCC 13, Release) on f38a036e: `guest_time_conversion` passes 5/5 (`--repeat until-fail:5`). The new case switches `TZ` from `UTC-2` to `UTC-5`, calls `tzset`, and checks that the epoch converts to 05:00 with `tm_gmtoff` 18000; it fails if `tzset` doesn't re-read `TZ`. `check_conventions.py` passes. Windows 11 (MinGW-w64 GCC 15.2 from WinLibs, Release): `guest_time_conversion` 5/5 with no warnings, so the `UTC-5` case passes through `_tzset` too. The Windows loader reports `FAIL: unresolved ELF import 0NJDcQ2B8vE (execvp) from libkernel.prx` first for PS5MC, on `main` and with this PR, so it reaches `tzset` there only once #2827 is in. ### Checklist - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
github-actions[bot] commented 2026-10-10 22:38:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T22:38:53Z.


Progress report (4fb937a → 502dae1)

📈 System libraries: 84.91% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libc tzset_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102939006 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3124#issuecomment-6102939006). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T22:38:53Z. --- <!-- progress-report --> ### Progress report (4fb937a → 502dae1) 📈 **System libraries**: 84.91% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libc | `tzset_nid_postfix` | </details>
adriadam10 commented 2026-10-10 22:43:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:43:52Z.


Checked on Linux: guest_time_conversion passes, and the test fails to link without the change. localtime_r on glibc does not re-read TZ after init, so the new case does exercise the export. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102977503 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3124#issuecomment-6102977503). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T22:43:52Z. --- Checked on Linux: `guest_time_conversion` passes, and the test fails to link without the change. `localtime_r` on glibc does not re-read `TZ` after init, so the new case does exercise the export. Merging once CI is green.
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!3124
No description provided.