feat(libSceSystemService): take the console date and time format from ANYPS5_DATE_FORMAT and ANYPS5_TIME_FORMAT, with auto from the host #12848

Merged
MarcZX10 merged 31 commits from upstream-pr/12848 into main 2026-11-07 03:27:44 +00:00
MarcZX10 commented 2026-10-29 12:33:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T12:33:25Z.


What

sceSystemServiceParamGetInt answered a fixed 1 for the date format (parameter 2, day-month-year) and a fixed 1 for the time format (parameter 3, 24-hour). Two new variables, siblings of ANYPS5_LANGUAGE:

  • ANYPS5_DATE_FORMAT: 0 year-month-day, 1 day-month-year, 2 month-day-year, or auto.
  • ANYPS5_TIME_FORMAT: 0 12-hour, 1 24-hour, or auto.

Unset and empty answer 1 and 1 exactly as before (read at each query). auto (any letter case) maps the host's short date and time patterns once per process; if the host has no preference or the pattern has no console format the answer stays 1 and one stderr line names the variable. Any other text stops the game at the first query of that parameter with an error naming the variable.

Numbers: 0/1/2 and 0/1 follow OpenOrbis-PS4-Toolchain 06fcf7fd108fa080035cdd3259ed22eb07e0508c (sys_service.h L17-L28) and shadPS4 0614ce324be092791b758d79f93d9f1ca5b10a81 (systemservice.h L29-L38). Neither is a console measurement; recorded in the debt doc. Time zone and summer time (parameters 4 and 5) already follow the host and are untouched. Week start is not implemented: no parameter id for it is sourced (debt entry). libSceRtc does not read these parameters.

Design (all in the new header core/libs/prx/libSceSystemService/DateTimeLocale.hpp, header only):

  • Classifiers for strftime patterns and for Windows/CLDR letter patterns read only the order of day, month, year and the 12/24-hour marker. An order the console has no format for, a missing or repeated field, or %x/%c/%X gives no answer.
  • Host sources behind HostPatterns: POSIX (LC_ALL, LC_TIME, LANG; D_FMT and T_FMT through newlocale/nl_langinfo_l, the process locale is untouched; C/POSIX count as no preference; T_FMT_AMPM is deliberately unused, glibc fills it for 24-hour locales), Windows (GetLocaleInfoEx LOCALE_SSHORTDATE/LOCALE_STIMEFORMAT), macOS (CFDateFormatter templates yMd/jms). Reader and environment are injected so the tests need no locale.
  • Unmeasured console choices are debt entries (one statement each) in docs/dev/debt/libSceSystemService.md.

Commits (29): classifiers, each followed by its test; resolver; POSIX/Windows/macOS sources; parsing; Export.cpp wiring (2 lines + include); guest test; env reference; one commit per debt statement; usage.

Overlap with open PRs (branched from upstream/main, not stacked): #12752 (ANYPS5_LANGUAGE=auto) shares no source file (it edits LanguageLocale.hpp and SystemService.hpp, which this PR does not touch) but both edit libSceSystemService/CMakeLists.txt (different blocks, mine next to guest_system_service_usb_storage), docs/dev/ENVIRONMENT.md (rows next to ANYPS5_LANGUAGE), docs/user/USAGE.md (new section after "Console language", which #12752 rewrites) and docs/dev/debt/libSceSystemService.md (it adds entries after the language entry; this PR appends a clause to the end of that language entry and adds entries after the time zone one). Expect trivial textual conflicts there. #9586 edits Export.cpp, CMakeLists.txt, SystemService.hpp and the debt doc; here Export.cpp changes only the two case lines of parameters 2 and 3 and one include. No open PR implements date or time format settings.

Tested

Linux x86_64 (Debian 12, kernel 6.1), GCC 12, throwaway archive build rebased on upstream/main aaccd0ba39 plus 240 commits (HEAD d9c2d08964), BUILD-EXIT 0.

  • New, all passed (each under 0.1 s): system_service_date_time_locale (host-only: classifiers, resolver and notice text, POSIX source with injected environments and nine glibc locales, real ReadLangInfo on C and an unknown name, setting parser), guest_system_service_date_time_format (unset/empty, 0..2 and 0..1, near misses refused per variable, neighbouring parameters, null pointers) and guest_system_service_date_time_format_host_0..11 (auto with nothing set, C, POSIX, an uninstalled locale, mixed with explicit and invalid values; exact stderr notice counts; a later host change does not change the answer).
  • Defaults unchanged: existing guest_system_service, guest_system_service_language, guest_system_service_time_zone pass on the branch and with Export.cpp restored to upstream/main in the same tree (baseline); the new default cases (host_7 and host_9: explicit 1/1 and unset) also pass on the baseline, the other eleven guest tests fail there as expected.
  • Negative controls (scratch copy, one mutation each, restored): 38 mutations of the header (order table, each strftime conversion, flags, E/O modifiers, repeats, 12/24 markers, weekday letters, L, quotes, t/K/a/k, resolver fallbacks and syntax choice, POSIX precedence, empty skip, C/POSIX names and separators, uninstalled locale, setting case, range, strictness, empty, host called once, error text) each fail at the intended assertion. Four assertion gaps found this way were closed (%x, t, a, K). Not controllable: the text.size() guard in the auto comparison (guards an out-of-bounds read; the mutation is equivalent in practice), and the doubled-quote branch, which was equivalent and is removed in its own commit.
  • Real glibc check by hand (not in CI, locales generated with localedef): D_FMT/T_FMT of en_US, en_GB, de_DE, fr_FR, hu_HU, sv_SE, ja_JP, ko_KR, zh_CN, en_CA, C, C.UTF-8 are the strings in the tests.
  • Static: check_conventions.py --base upstream/main (one warning: the existing language entry in the debt doc was already over 1000 characters and the one-clause edit makes the checker report it; no errors), git diff --check, test_public_headers.py --audit-only, env_reference.py --check clean.

NOT RUN: Windows (GetLocaleInfoEx branch only syntax-checked with MinGW), macOS (CoreFoundation branch only syntax-checked against a stub; the yMd/jms outputs and the 24-hour override are unverified), musl and BSD libc, a non-English real host through the whole stack, a console, any title. guest_user_service and guest_convert_keycode were not built (they do not touch these parameters).

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:5068066279 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12848). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T12:33:25Z. --- ### What `sceSystemServiceParamGetInt` answered a fixed 1 for the date format (parameter 2, day-month-year) and a fixed 1 for the time format (parameter 3, 24-hour). Two new variables, siblings of `ANYPS5_LANGUAGE`: - `ANYPS5_DATE_FORMAT`: 0 year-month-day, 1 day-month-year, 2 month-day-year, or `auto`. - `ANYPS5_TIME_FORMAT`: 0 12-hour, 1 24-hour, or `auto`. Unset and empty answer 1 and 1 exactly as before (read at each query). `auto` (any letter case) maps the host's short date and time patterns once per process; if the host has no preference or the pattern has no console format the answer stays 1 and one stderr line names the variable. Any other text stops the game at the first query of that parameter with an error naming the variable. Numbers: 0/1/2 and 0/1 follow OpenOrbis-PS4-Toolchain 06fcf7fd108fa080035cdd3259ed22eb07e0508c (`sys_service.h` L17-L28) and shadPS4 0614ce324be092791b758d79f93d9f1ca5b10a81 (`systemservice.h` L29-L38). Neither is a console measurement; recorded in the debt doc. Time zone and summer time (parameters 4 and 5) already follow the host and are untouched. Week start is not implemented: no parameter id for it is sourced (debt entry). libSceRtc does not read these parameters. Design (all in the new header `core/libs/prx/libSceSystemService/DateTimeLocale.hpp`, header only): - Classifiers for strftime patterns and for Windows/CLDR letter patterns read only the order of day, month, year and the 12/24-hour marker. An order the console has no format for, a missing or repeated field, or `%x`/`%c`/`%X` gives no answer. - Host sources behind `HostPatterns`: POSIX (`LC_ALL`, `LC_TIME`, `LANG`; `D_FMT` and `T_FMT` through `newlocale`/`nl_langinfo_l`, the process locale is untouched; C/POSIX count as no preference; `T_FMT_AMPM` is deliberately unused, glibc fills it for 24-hour locales), Windows (`GetLocaleInfoEx` `LOCALE_SSHORTDATE`/`LOCALE_STIMEFORMAT`), macOS (`CFDateFormatter` templates `yMd`/`jms`). Reader and environment are injected so the tests need no locale. - Unmeasured console choices are debt entries (one statement each) in docs/dev/debt/libSceSystemService.md. Commits (29): classifiers, each followed by its test; resolver; POSIX/Windows/macOS sources; parsing; Export.cpp wiring (2 lines + include); guest test; env reference; one commit per debt statement; usage. Overlap with open PRs (branched from upstream/main, not stacked): #12752 (`ANYPS5_LANGUAGE=auto`) shares no source file (it edits LanguageLocale.hpp and SystemService.hpp, which this PR does not touch) but both edit libSceSystemService/CMakeLists.txt (different blocks, mine next to `guest_system_service_usb_storage`), docs/dev/ENVIRONMENT.md (rows next to `ANYPS5_LANGUAGE`), docs/user/USAGE.md (new section after "Console language", which #12752 rewrites) and docs/dev/debt/libSceSystemService.md (it adds entries after the language entry; this PR appends a clause to the end of that language entry and adds entries after the time zone one). Expect trivial textual conflicts there. #9586 edits Export.cpp, CMakeLists.txt, SystemService.hpp and the debt doc; here Export.cpp changes only the two `case` lines of parameters 2 and 3 and one include. No open PR implements date or time format settings. ### Tested Linux x86_64 (Debian 12, kernel 6.1), GCC 12, throwaway archive build rebased on upstream/main aaccd0ba39 plus 240 commits (HEAD d9c2d08964), `BUILD-EXIT 0`. - New, all passed (each under 0.1 s): `system_service_date_time_locale` (host-only: classifiers, resolver and notice text, POSIX source with injected environments and nine glibc locales, real `ReadLangInfo` on C and an unknown name, setting parser), `guest_system_service_date_time_format` (unset/empty, 0..2 and 0..1, near misses refused per variable, neighbouring parameters, null pointers) and `guest_system_service_date_time_format_host_0..11` (auto with nothing set, C, POSIX, an uninstalled locale, mixed with explicit and invalid values; exact stderr notice counts; a later host change does not change the answer). - Defaults unchanged: existing `guest_system_service`, `guest_system_service_language`, `guest_system_service_time_zone` pass on the branch and with Export.cpp restored to upstream/main in the same tree (baseline); the new default cases (`host_7` and `host_9`: explicit 1/1 and unset) also pass on the baseline, the other eleven guest tests fail there as expected. - Negative controls (scratch copy, one mutation each, restored): 38 mutations of the header (order table, each strftime conversion, flags, E/O modifiers, repeats, 12/24 markers, weekday letters, L, quotes, t/K/a/k, resolver fallbacks and syntax choice, POSIX precedence, empty skip, C/POSIX names and separators, uninstalled locale, setting case, range, strictness, empty, host called once, error text) each fail at the intended assertion. Four assertion gaps found this way were closed (`%x`, `t`, `a`, `K`). Not controllable: the `text.size()` guard in the `auto` comparison (guards an out-of-bounds read; the mutation is equivalent in practice), and the doubled-quote branch, which was equivalent and is removed in its own commit. - Real glibc check by hand (not in CI, locales generated with localedef): D_FMT/T_FMT of en_US, en_GB, de_DE, fr_FR, hu_HU, sv_SE, ja_JP, ko_KR, zh_CN, en_CA, C, C.UTF-8 are the strings in the tests. - Static: `check_conventions.py --base upstream/main` (one warning: the existing language entry in the debt doc was already over 1000 characters and the one-clause edit makes the checker report it; no errors), `git diff --check`, `test_public_headers.py --audit-only`, `env_reference.py --check` clean. NOT RUN: Windows (`GetLocaleInfoEx` branch only syntax-checked with MinGW), macOS (CoreFoundation branch only syntax-checked against a stub; the `yMd`/`jms` outputs and the 24-hour override are unverified), musl and BSD libc, a non-English real host through the whole stack, a console, any title. `guest_user_service` and `guest_convert_keycode` were not built (they do not touch these parameters). ### 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 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
CnRJay commented 2026-11-01 20:02:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T20:02:42Z.

Review: COMMENTED


Correction (2026-11-01): this review demanded a title for a PR where no title can supply one. CONTRIBUTING allows Unblocks: none. The technical points below are unaffected.

No title ID and no log line: the description names none, and libSceRtc does not read these parameters. Unset keeps today's answer, so nothing on main changes until a user opts in; this is a convenience feature, not a fix for a title.

  1. Approximate fallback, logged. The description says that with auto, "if the host has no preference or the pattern has no console format the answer stays 1 and one stderr line names the variable". That returns a made-up answer (day-month-year, 24-hour) for a host the code could not classify. Upstream has been rejecting logged fallbacks of that kind; the exact-or-throw behaviour is to throw naming ANYPS5_DATE_FORMAT / ANYPS5_TIME_FORMAT, as the explicit-text path already does.
  2. Numbers are not measured. The 0/1/2 and 0/1 meanings come from OpenOrbis and shadPS4 headers; the description says neither is a console measurement. It is worth saying which of the two the console value 1 (the existing default) was taken from, since this PR now makes the other values reachable.
  3. Unbuilt platform branches. The description says the Windows GetLocaleInfoEx branch is only syntax-checked with MinGW and the macOS CoreFoundation branch only against a stub, with the yMd/jms outputs and the 24-hour override unverified. I would not take those two branches in without a build on those hosts.
  4. Overlap with #12752 and #12895. All three add rows to docs/dev/ENVIRONMENT.md and docs/user/USAGE.md and touch libSceSystemService. Worth agreeing the landing order with the other two authors.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729966175 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12848#pullrequestreview-5729966175). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T20:02:42Z. **Review:** COMMENTED --- **Correction (2026-11-01):** this review demanded a title for a PR where no title can supply one. CONTRIBUTING allows `Unblocks: none`. The technical points below are unaffected. No title ID and no log line: the description names none, and `libSceRtc does not read these parameters`. Unset keeps today's answer, so nothing on `main` changes until a user opts in; this is a convenience feature, not a fix for a title. 1. **Approximate fallback, logged.** The description says that with `auto`, "if the host has no preference or the pattern has no console format the answer stays 1 and one stderr line names the variable". That returns a made-up answer (day-month-year, 24-hour) for a host the code could not classify. Upstream has been rejecting logged fallbacks of that kind; the exact-or-throw behaviour is to throw naming `ANYPS5_DATE_FORMAT` / `ANYPS5_TIME_FORMAT`, as the explicit-text path already does. 2. **Numbers are not measured.** The 0/1/2 and 0/1 meanings come from OpenOrbis and shadPS4 headers; the description says neither is a console measurement. It is worth saying which of the two the console value 1 (the existing default) was taken from, since this PR now makes the other values reachable. 3. **Unbuilt platform branches.** The description says the Windows `GetLocaleInfoEx` branch is only syntax-checked with MinGW and the macOS CoreFoundation branch only against a stub, with the `yMd`/`jms` outputs and the 24-hour override unverified. I would not take those two branches in without a build on those hosts. 4. **Overlap with #12752 and #12895.** All three add rows to `docs/dev/ENVIRONMENT.md` and `docs/user/USAGE.md` and touch `libSceSystemService`. Worth agreeing the landing order with the other two authors.
MarcZX10 commented 2026-11-02 04:58:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:58:10Z.

Review: COMMENTED


Reviewed — four review points need an answer; the fallbacks are confirmed

CnRJay asks for exact-or-throw on auto when the host has no usable pattern, and for the sources of the numbers. The head returns day-month-year and 24-hour with a logged notice, and the debt entry does not say which source the default 1 comes from.

What I ran

Live head: 62e5106cbbba31500ffa5e798611b8ff8b404d9a (OPEN, same as the batch file). Read the comments and reviews with gh api (repos/boykopovar/AnyPS5/issues|pulls/12848/...). Read files with git -C /marc/AnyPS5 show 62e5106c…:<path>: DateTimeLocale.hpp, CMakeLists.txt, docs/dev/debt/libSceSystemService.md, CONTRIBUTING.md. Read the hosted check rollup with gh pr view. Nothing was built or run.

Results

Check Result Note
windows SUCCESS hosted, at this head
conventions SUCCESS hosted, at this head
linux, relinker SKIPPED hosted workflow skipped them

Findings

  • Point 1, logged fallback: confirmed. ResolveHostDateFormat notes and returns 1 (DateTimeLocale.hpp L151-L160). ResolveHostTimeFormat notes and returns 24-hour (L163-L172).
  • Point 2, numbers: the constants are DATE_FORMAT_DDMMYYYY = 1 (L27) and TIME_FORMAT_24HOUR = 1 (L30). The debt entry (docs/dev/debt/libSceSystemService.md L27) cites OpenOrbis and shadPS4 and does not say which one the default 1 came from.
  • Point 3, unbuilt branches: Windows GetLocaleInfoEx is at L236-L255, macOS CoreFoundation at L256-L280. The _host_* date tests are registered only under Linux (CMakeLists.txt L119-L135), so no registered test reaches the macOS host patterns. tkcm01's macOS run (2026-10-29) was on an earlier head, d9c2d08, and I did not re-run it.
  • Point 4, overlap: this PR and #12752 both touch docs/dev/ENVIRONMENT.md and docs/user/USAGE.md.
  • The "Unblocks" item is withdrawn in the review header; CONTRIBUTING.md L66 allows none.

Sources

Not verified

  • The macOS result: reported on d9c2d08, not re-run here.
  • The upstream sources behind the number 1: not checked.
  • Overlap with #12895: not checked.
  • Nothing was built or run here.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732253321 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12848#pullrequestreview-5732253321). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T04:58:10Z. **Review:** COMMENTED --- # Reviewed — four review points need an answer; the fallbacks are confirmed CnRJay asks for exact-or-throw on `auto` when the host has no usable pattern, and for the sources of the numbers. The head returns day-month-year and 24-hour with a logged notice, and the debt entry does not say which source the default 1 comes from. ## What I ran Live head: 62e5106cbbba31500ffa5e798611b8ff8b404d9a (OPEN, same as the batch file). Read the comments and reviews with `gh api` (repos/boykopovar/AnyPS5/issues|pulls/12848/...). Read files with `git -C /marc/AnyPS5 show 62e5106c…:<path>`: DateTimeLocale.hpp, CMakeLists.txt, docs/dev/debt/libSceSystemService.md, CONTRIBUTING.md. Read the hosted check rollup with `gh pr view`. Nothing was built or run. ## Results | Check | Result | Note | |---|---|---| | windows | SUCCESS | hosted, at this head | | conventions | SUCCESS | hosted, at this head | | linux, relinker | SKIPPED | hosted workflow skipped them | ## Findings - Point 1, logged fallback: confirmed. `ResolveHostDateFormat` notes and returns 1 (DateTimeLocale.hpp L151-L160). `ResolveHostTimeFormat` notes and returns 24-hour (L163-L172). - Point 2, numbers: the constants are `DATE_FORMAT_DDMMYYYY = 1` (L27) and `TIME_FORMAT_24HOUR = 1` (L30). The debt entry (docs/dev/debt/libSceSystemService.md L27) cites OpenOrbis and shadPS4 and does not say which one the default 1 came from. - Point 3, unbuilt branches: Windows `GetLocaleInfoEx` is at L236-L255, macOS CoreFoundation at L256-L280. The `_host_*` date tests are registered only under Linux (CMakeLists.txt L119-L135), so no registered test reaches the macOS host patterns. tkcm01's macOS run (2026-10-29) was on an earlier head, d9c2d08, and I did not re-run it. - Point 4, overlap: this PR and #12752 both touch docs/dev/ENVIRONMENT.md and docs/user/USAGE.md. - The "Unblocks" item is withdrawn in the review header; CONTRIBUTING.md L66 allows `none`. ## Sources - https://github.com/boykopovar/AnyPS5/blob/62e5106cbbba31500ffa5e798611b8ff8b404d9a/core/libs/prx/libSceSystemService/DateTimeLocale.hpp#L151-L172 - https://github.com/boykopovar/AnyPS5/blob/62e5106cbbba31500ffa5e798611b8ff8b404d9a/core/libs/prx/libSceSystemService/DateTimeLocale.hpp#L27-L30 - https://github.com/boykopovar/AnyPS5/blob/62e5106cbbba31500ffa5e798611b8ff8b404d9a/docs/dev/debt/libSceSystemService.md#L27-L27 - https://github.com/boykopovar/AnyPS5/blob/62e5106cbbba31500ffa5e798611b8ff8b404d9a/core/libs/prx/libSceSystemService/CMakeLists.txt#L119-L135 ## Not verified - The macOS result: reported on d9c2d08, not re-run here. - The upstream sources behind the number 1: not checked. - Overlap with #12895: not checked. - Nothing was built or run here.
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!12848
No description provided.