feat(libSceLibcInternal): implement remaining time_get facets #22526

Merged
MarrasFederico merged 1 commit from upstream-pr/22526 into main 2026-11-18 04:21:04 +00:00
MarrasFederico commented 2026-11-17 19:00:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarrasFederico on 2026-11-17T19:00:15Z.


What

Implements the eight remaining std::time_get exports in core/libs/prx/libSceLibcInternal/TimeGetFields.cpp and wires the remaining GuestLocale::TimeGetVtable slots in g_wideTimeGetVtable:

  • time_get<char>::_Getint (8raXTYQ11cg) and time_get<char>::_Getfmt (E7UermPZVcw), parameterizing _Getfmt in DoGetFmtImpl<TChar> across char and wchar_t (adapted from Microsoft STL stl/inc/xloctime @ 770da5aa457af11f0a796600e1aa6f7f6fce14a6).
  • time_get<char>::do_get_date (T85u2sPrKOo) and time_get<wchar_t>::do_get_date (SYCwZXKZQ08) via DoGetDateImpl<TChar> supporting no_order (mdy), dmy, mdy, ymd, and ydm component ordering, month-name overrides, and : / , / / separators with surrounding whitespace.
  • time_get<char>::do_get_weekday (xzYpD5d24aA) and time_get<wchar_t>::do_get_weekday (hGlkh5YpcKw) via shared DoGetNameFieldImpl<TChar>.
  • time_get<char>::do_get (Vw03kdKZUN0) and time_get<wchar_t>::do_get (0MzJAexrlr4) via DoGetImpl<TChar> across all Dinkumware format specifiers (a, A, b, B, h, c, C, d, e, D, H, I, j, m, M, n, t, p, r, R, S, T, X, U, W, w, x, y, Y, %, and unknown specifier failbit handling).
  • Wires g_wideTimeGetVtable slots getDate, getWeekday, and get to the wide do_get_date, do_get_weekday, and do_get exports (removing TimeFieldsWideUnsupported_nid_no_patch and TimeFieldsWideFieldUnsupported_nid_no_patch), removes the eight stub exports from core/libs/prx/libSceLibcInternal/Export.cpp, declares the eight exports in core/libs/prx/libSceLibcInternal/include/TimeGetFields.hpp, updates the #21895 wide %H throwing expectation and adds coverage in core/libs/tests/GuestLibcInternalTimeGetFields.cpp, and adds the debt fragment docs/dev/debt/changes/feat-libcinternal-time-get-remaining.md.

Based on main at b1727795a26b265ea42de24c754084bd0f9a2b7d; checked with git merge-tree against live main before publication.

Tested

Linux x86-64 (Release, GCC 15.2.0, Ninja, -DBUILD_TESTING=ON), not tested on Windows or hardware console:

  • Built targets guest_libc_internal_time_get_fields_tests and guest_libc_internal_time_get_tests.
  • Post-commit ctest --output-on-failure -R "^guest_libc_internal_time_get": 2/2 passed (guest_libc_internal_time_get, guest_libc_internal_time_get_fields), plus 3 consecutive passing pre-commit test runs covering buffered and unbuffered streambuf, all date orders, all do_get specifiers, g_wideTimeGetVtable dispatch, dynamic dlsym lookup of all 8 _nid_postfix symbols in libSceLibcInternal.prx, and null-argument NotImplemented error paths.
  • Negative check: mutating ans == 12 ? 0 : ans to ans == 12 ? 12 : ans in DoGetImpl caused guest_libc_internal_time_get_fields to fail as expected; restoring exact file SHA-256 restored the pass.
  • Static checks passed: python3 tools/check_conventions.py (0 findings, 0 errors), python3 core/libs/tests/test_public_headers.py --audit-only (413 libraries, 34713 exports), python3 tools/debt_fold.py --check, git diff --check, and clean git merge-tree --write-tree HEAD upstream/main. Overlap notes: pr_overlap.py --names shows no competing implementation PR; pr_overlap.py --branch reports #22462 conflicting on lines of main (TimeGetFields.cpp L395, L570-572, L596-602, L653-656, L658-685 and GuestLibcInternalTimeGetFields.cpp L16, L65-72, L690, L707), alias-rename #17300, and fail-closed Shared files not compared entries (#13778, #17300, #18135).

The constructor follow-up #22528 is independent but shares TimeGetFields.cpp, its public header, the test and CMake registration; landing either first will require resolving those textual changes while retaining both sets of tests. #22462 is a separate guest-pointer safety fix; this branch does not include it and its safety changes must be retained when combining the branches. The full shared-file diffs were checked manually, including comparisons the overlap tool could not complete; #17300 only renames throwing aliases, not their implementation.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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:5363125519 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22526). Originally posted by [MarrasFederico](https://github.com/MarrasFederico) on 2026-11-17T19:00:15Z. --- ### What Implements the eight remaining `std::time_get` exports in `core/libs/prx/libSceLibcInternal/TimeGetFields.cpp` and wires the remaining `GuestLocale::TimeGetVtable` slots in `g_wideTimeGetVtable`: - `time_get<char>::_Getint` (`8raXTYQ11cg`) and `time_get<char>::_Getfmt` (`E7UermPZVcw`), parameterizing `_Getfmt` in `DoGetFmtImpl<TChar>` across `char` and `wchar_t` (adapted from Microsoft STL `stl/inc/xloctime` @ `770da5aa457af11f0a796600e1aa6f7f6fce14a6`). - `time_get<char>::do_get_date` (`T85u2sPrKOo`) and `time_get<wchar_t>::do_get_date` (`SYCwZXKZQ08`) via `DoGetDateImpl<TChar>` supporting `no_order` (`mdy`), `dmy`, `mdy`, `ymd`, and `ydm` component ordering, month-name overrides, and `:` / `,` / `/` separators with surrounding whitespace. - `time_get<char>::do_get_weekday` (`xzYpD5d24aA`) and `time_get<wchar_t>::do_get_weekday` (`hGlkh5YpcKw`) via shared `DoGetNameFieldImpl<TChar>`. - `time_get<char>::do_get` (`Vw03kdKZUN0`) and `time_get<wchar_t>::do_get` (`0MzJAexrlr4`) via `DoGetImpl<TChar>` across all Dinkumware format specifiers (`a`, `A`, `b`, `B`, `h`, `c`, `C`, `d`, `e`, `D`, `H`, `I`, `j`, `m`, `M`, `n`, `t`, `p`, `r`, `R`, `S`, `T`, `X`, `U`, `W`, `w`, `x`, `y`, `Y`, `%`, and unknown specifier `failbit` handling). - Wires `g_wideTimeGetVtable` slots `getDate`, `getWeekday`, and `get` to the wide `do_get_date`, `do_get_weekday`, and `do_get` exports (removing `TimeFieldsWideUnsupported_nid_no_patch` and `TimeFieldsWideFieldUnsupported_nid_no_patch`), removes the eight stub exports from `core/libs/prx/libSceLibcInternal/Export.cpp`, declares the eight exports in `core/libs/prx/libSceLibcInternal/include/TimeGetFields.hpp`, updates the `#21895` wide `%H` throwing expectation and adds coverage in `core/libs/tests/GuestLibcInternalTimeGetFields.cpp`, and adds the debt fragment `docs/dev/debt/changes/feat-libcinternal-time-get-remaining.md`. Based on `main` at `b1727795a26b265ea42de24c754084bd0f9a2b7d`; checked with `git merge-tree` against live `main` before publication. ### Tested Linux x86-64 (Release, GCC 15.2.0, Ninja, `-DBUILD_TESTING=ON`), not tested on Windows or hardware console: - Built targets `guest_libc_internal_time_get_fields_tests` and `guest_libc_internal_time_get_tests`. - Post-commit `ctest --output-on-failure -R "^guest_libc_internal_time_get"`: `2/2` passed (`guest_libc_internal_time_get`, `guest_libc_internal_time_get_fields`), plus `3` consecutive passing pre-commit test runs covering buffered and unbuffered `streambuf`, all date orders, all `do_get` specifiers, `g_wideTimeGetVtable` dispatch, dynamic `dlsym` lookup of all 8 `_nid_postfix` symbols in `libSceLibcInternal.prx`, and null-argument `NotImplemented` error paths. - Negative check: mutating `ans == 12 ? 0 : ans` to `ans == 12 ? 12 : ans` in `DoGetImpl` caused `guest_libc_internal_time_get_fields` to fail as expected; restoring exact file SHA-256 restored the pass. - Static checks passed: `python3 tools/check_conventions.py` (`0 findings, 0 errors`), `python3 core/libs/tests/test_public_headers.py --audit-only` (`413 libraries, 34713 exports`), `python3 tools/debt_fold.py --check`, `git diff --check`, and clean `git merge-tree --write-tree HEAD upstream/main`. Overlap notes: `pr_overlap.py --names` shows no competing implementation PR; `pr_overlap.py --branch` reports `#22462` conflicting on lines of `main` (`TimeGetFields.cpp` `L395`, `L570-572`, `L596-602`, `L653-656`, `L658-685` and `GuestLibcInternalTimeGetFields.cpp` `L16`, `L65-72`, `L690`, `L707`), alias-rename `#17300`, and fail-closed `Shared files not compared` entries (`#13778`, `#17300`, `#18135`). The constructor follow-up #22528 is independent but shares `TimeGetFields.cpp`, its public header, the test and CMake registration; landing either first will require resolving those textual changes while retaining both sets of tests. #22462 is a separate guest-pointer safety fix; this branch does not include it and its safety changes must be retained when combining the branches. The full shared-file diffs were checked manually, including comparisons the overlap tool could not complete; #17300 only renames throwing aliases, not their implementation. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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
PrivacyOnion commented 2026-11-17 19:01:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T19:01:57Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 8959f868ed:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libc_internal_time_get_fields_tests built cleanly.
  • CTest (guest_libc_internal_time_get_fields):
    1/1 Test #4244: guest_libc_internal_time_get_fields ...   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceLibcInternal/Export.cpp, core/libs/prx/libSceLibcInternal/TimeGetFields.cpp, core/libs/prx/libSceLibcInternal/include/TimeGetFields.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceLibcInternal/TimeGetFields.cpp: verified DoGetDateImpl correctly parses date order combinations (dmy, mdy, ymd, ydm) and handles month names and separator skips
    • core/libs/prx/libSceLibcInternal/TimeGetFields.cpp: verified DoGetImpl handles all specifiers (a, A, b, B, h, c, C, d, e, D, H, I, j, m, M, n, t, p, r, R, S, T, X, U, W, w, x, y, Y, %) and properly sets failbit for invalid/unrecognized specifiers
    • core/libs/prx/libSceLibcInternal/TimeGetFields.cpp: verified DoGetFmtImpl loops correctly, matches literal chars, skips whitespace on space, and delegates % specifiers to vtable->get
    • core/libs/prx/libSceLibcInternal/TimeGetFields.cpp: checked null pointer assertions via RequireArgument across DoGetNameFieldImpl, GetIntImpl, DoGetDateImpl, DoGetFmtImpl, and DoGetImpl
    • core/libs/prx/libSceLibcInternal/Export.cpp and g_wideTimeGetVtable: verified removal of old stub exports and correct wiring of wide getDate, getWeekday, and get vtable slots
    • docs/dev/debt/changes/feat-libcinternal-time-get-remaining.md: verified debt removals and additions match AGENTS.md rules

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5944753551 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22526#pullrequestreview-5944753551). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-17T19:01:57Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `8959f868ed`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libc_internal_time_get_fields_tests` built cleanly. - **CTest** (`guest_libc_internal_time_get_fields`): ``` 1/1 Test #4244: guest_libc_internal_time_get_fields ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceLibcInternal/Export.cpp`, `core/libs/prx/libSceLibcInternal/TimeGetFields.cpp`, `core/libs/prx/libSceLibcInternal/include/TimeGetFields.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceLibcInternal/TimeGetFields.cpp: verified DoGetDateImpl correctly parses date order combinations (dmy, mdy, ymd, ydm) and handles month names and separator skips - core/libs/prx/libSceLibcInternal/TimeGetFields.cpp: verified DoGetImpl handles all specifiers (a, A, b, B, h, c, C, d, e, D, H, I, j, m, M, n, t, p, r, R, S, T, X, U, W, w, x, y, Y, %) and properly sets failbit for invalid/unrecognized specifiers - core/libs/prx/libSceLibcInternal/TimeGetFields.cpp: verified DoGetFmtImpl loops correctly, matches literal chars, skips whitespace on space, and delegates % specifiers to vtable->get - core/libs/prx/libSceLibcInternal/TimeGetFields.cpp: checked null pointer assertions via RequireArgument across DoGetNameFieldImpl, GetIntImpl, DoGetDateImpl, DoGetFmtImpl, and DoGetImpl - core/libs/prx/libSceLibcInternal/Export.cpp and g_wideTimeGetVtable: verified removal of old stub exports and correct wiring of wide getDate, getWeekday, and get vtable slots - docs/dev/debt/changes/feat-libcinternal-time-get-remaining.md: verified debt removals and additions match AGENTS.md rules Looks Good To Me
PrivacyOnion commented 2026-11-17 19:43:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T19:43:52Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 00ad30a7ee:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libc_internal_time_get_fields_tests built cleanly.
  • CTest (guest_libc_internal_time_get_fields):
    1/1 Test #4245: guest_libc_internal_time_get_fields ...   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceLibcInternal/Export.cpp, core/libs/prx/libSceLibcInternal/TimeGetFields.cpp, core/libs/prx/libSceLibcInternal/include/TimeGetFields.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified DoGetDateImpl in TimeGetFields.cpp correctly enforces date order rules (dmy, mdy, ymd, ydm), digit vs non-digit month matching, and separator skipping
    • Verified DoGetFmtImpl in TimeGetFields.cpp accurately iterates format strings, ignores space matching via CtypeSpaceMask, and dispatches % conversions to vtable->get
    • Verified DoGetImpl in TimeGetFields.cpp covers all standard Dinkumware specifiers (a, A, b, B, h, c, C, d, e, D, H, I, j, m, M, n, t, p, r, R, S, T, X, U, W, w, x, y, Y, %) and properly flags IosFailBit on unknown specifiers or truncated streams
    • Verified null pointer and argument validation in RequireArgument across DoGetNameFieldImpl, GetIntImpl, DoGetDateImpl, DoGetFmtImpl, and DoGetImpl
    • Verified g_wideTimeGetVtable wiring and removal of former stub exports from Export.cpp
    • Verified AGENTS.md compliance regarding comments, debt fragment additions/removals in docs/dev/debt/changes/feat-libcinternal-time-get-remaining.md, and test coverage in GuestLibcInternalTimeGetFields.cpp

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5945380213 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22526#pullrequestreview-5945380213). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-17T19:43:52Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `00ad30a7ee`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libc_internal_time_get_fields_tests` built cleanly. - **CTest** (`guest_libc_internal_time_get_fields`): ``` 1/1 Test #4245: guest_libc_internal_time_get_fields ... Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceLibcInternal/Export.cpp`, `core/libs/prx/libSceLibcInternal/TimeGetFields.cpp`, `core/libs/prx/libSceLibcInternal/include/TimeGetFields.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified DoGetDateImpl in TimeGetFields.cpp correctly enforces date order rules (dmy, mdy, ymd, ydm), digit vs non-digit month matching, and separator skipping - Verified DoGetFmtImpl in TimeGetFields.cpp accurately iterates format strings, ignores space matching via CtypeSpaceMask, and dispatches % conversions to vtable->get - Verified DoGetImpl in TimeGetFields.cpp covers all standard Dinkumware specifiers (a, A, b, B, h, c, C, d, e, D, H, I, j, m, M, n, t, p, r, R, S, T, X, U, W, w, x, y, Y, %) and properly flags IosFailBit on unknown specifiers or truncated streams - Verified null pointer and argument validation in RequireArgument across DoGetNameFieldImpl, GetIntImpl, DoGetDateImpl, DoGetFmtImpl, and DoGetImpl - Verified g_wideTimeGetVtable wiring and removal of former stub exports from Export.cpp - Verified AGENTS.md compliance regarding comments, debt fragment additions/removals in docs/dev/debt/changes/feat-libcinternal-time-get-remaining.md, and test coverage in GuestLibcInternalTimeGetFields.cpp Looks Good To Me
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!22526
No description provided.