feat(libSceLibcInternal): read time fields and build time_get/time_put facets #21895
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21895"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarrasFederico on 2026-11-16T20:32:30Z.
What
16
time_getandtime_putexports oflibSceLibcInternalthrewNotImplemented. They now work. The code is in the newTimeGetFields.cpp. The stubs leaveExport.cppandInventoryExports6.cpp.do_get_time,do_get_yearanddo_get_monthnameforcharandwchar_t.do_get_timereadsHH:MM:SSwith ranges[0, 23],[0, 59]and[0, 60]. It fails as soon as the state is not good.do_get_yearreads up to 4 digits. With 1 or 2 digits, 0 to 68 become 2000 to 2068 and 69 to 99 stay in the 1900s. With more digits the year is literal. This is the rule #17568 reads from the consolelibc.prxforstd::__sce_v2.do_get_monthnamematches month names without case, longest prefix first, through thectypeof the global locale. A partial match fails. It does not seteofbit._Getint(wchar_t). Reads at most as many digits as the upper bound has. Leading spaces count as digits. It takes a sign, keeps one leading zero and converts with_Stolx. On failure the value is left as it was. It setseofbitat the end of input.get(fmt, fmtend)and_Getfmt(wchar_t).getclears the state, stops once it is not good, skips spaces, matches literals without case and reads theE,O,Qand#modifiers._Getfmtmatches literals with case and setseofbitat the end. Both call the facet'sdo_getvirtual for each%field.time_get<wchar_t>(const char*, size_t)(C1, C2) accepts only"C", through_Locinfo. It fills the first0x30bytes: static C-locale names and date ordermdy. Itsdo_get_date,do_get_weekdayanddo_getslots throw.time_getD2 destructors free nothing, like the console's single-ret_Tidy.time_put<char>(C1 with_Locinfo, C2) fills its0xb8bytes from_Getptimes.time_put<wchar_t>(C1) writes only the0x10-byte facet header and does not call_Init.time_put<wchar_t>::_Initkeeps throwing, now with its real signature: its_Tnamespast+0x10is unverified.0x2cand0x10, the static month table oftime_get<char>and the slots that still throw.Parsing follows Dinkumware's
xloctimeas kept in microsoft/STL at770da5aa45. The licence notice is at the top of the file.Tested
Ubuntu 26.04.1 LTS, GCC 15.2.0, Release,
BUILD_TESTING=ON. Branch based on207fca028a; it merges withmainatf2a25e5b42without conflicts. Not run in a title.guest_libc_internal_time_get_fields. It reads from buffered and unbuffered (underflow/uflow) stream buffers. It covers construction, reference counts and untouched bytes past thewchar_tfacets,_Getint(width, leading zeros and spaces, sign, range, end of input), the three field readers for both character types,getand_Getfmtwith a customctype<wchar_t>, and null arguments.ctest -R "^(guest_libc_internal_(time_get|time_get_fields|facet_put|facet_queries|empty_facet_members|locale_objects|wide_ctype|showmanyc|num_get)|guest_locale|guest_strftime|guest_ctype_case)$": 12 of 12 passed. The new test passed 3 runs in a row.do_get_monthname case-insensitive full name.tools/check_conventions.py,test_public_headers.py --audit-onlyandgit diff --checkpass.tools/pr_overlap.py --names: no open PR implements these 17 names.--branch: no open PR shares an export or a new file. #19434, #19602, #19609, #20059 and #20834 touch nearby lines: the end ofCMakeLists.txtandlibSceLibcInternal.hpp, and the stubs next todo_date_orderinExport.cpp. #13778, #14834, #17300 and #18135 could not be compared automatically; by hand, none of them changes these 17 functions.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T21:35:00Z.
Review: COMMENTED
Reviewed — comments
This implementation has focused host-side tests, but the review is incomplete because not every changed line and changed file was inspected.
What I ran
Reviewed head
6dcaff9ed730247f78ec7ea659ee8dd6387b5b16. No commands or tests were run by this reviewer; the description reports Ubuntu 26.04.1, GCC 15.2.0 tests and checks, which I did not independently run.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
The full added test source, changed export and inventory files, and portions of the manifest and diff were not inspected. In particular, the tests do not independently verify iterator behavior against production stream buffers, and no console behavior was confirmed. Files read:
description.md,commits.md,README.md,manifest.json(partial),diff.patch(partial),TimeGetFields.cpp,TimeGetFields.hpp,libSceLibcInternal.hpp,CMakeLists.txt(partial), and the debt change record. The changed files reported by the manifest areCMakeLists.txt,Export.cpp,InventoryExports6.cpp,TimeGetFields.cpp,InventoryExports6.hpp,PendingExports.hpp,TimeGetFields.hpp,libSceLibcInternal.hpp,GuestLibcInternalTimeGetFields.cpp, andfeat-libcinternal-time-get-fields.md; not all were fully reviewed.To get this to a good state
Nothing is required. The author may share the console verification status when available.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T22:28:27Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
819d98b3e9:tools/check_conventions.pypassed.guest_libc_internal_time_get_fields_testsbuilt cleanly.guest_libc_internal_time_get_fields):core/libs/prx/libSceLibcInternal/Export.cpp,core/libs/prx/libSceLibcInternal/InventoryExports6.cpp,core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp,core/libs/prx/libSceLibcInternal/include/PendingExports.hpp,core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp,core/libs/prx/libSceLibcInternal/TimeGetFields.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me