feat(rtc): implement sceRtcFormatRFC2822 and the RFC 2822/3339 local-time formatters #804

Merged
adriadam10 merged 1 commit from upstream-pr/804 into main 2026-10-06 09:31:59 +00:00
adriadam10 commented 2026-10-06 05:28:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-06T05:28:02Z.


What

Implements three libSceRtc formatters that main did not declare at all (NIDs eiuobaF-hK4, AxHBk3eat04, DwuHIlLGW8I):

  • sceRtcFormatRFC2822(buf, utc, minutes): Thu, 29 Feb 2024 14:04:56 +0130 (weekday, two-digit day, month name, four-digit year, ±HHMM; +0000 for 0).
  • sceRtcFormatRFC2822LocalTime(buf, utc) and sceRtcFormatRFC3339LocalTime(buf, utc): the same formatters (the existing sceRtcFormatRFC3339 for the latter) with the host's local offset.

Reference: shadPS4 rtc.cpp is the only body (fpPS4 has them as TODO, SharpProspero has signatures only). Where we differ from it:

  • Zone suffix: shadPS4 prints the minutes without padding (+015 for 65 minutes) and takes the sign from the hours, so -30 comes out as +030. Here it is %02d%02d with the sign of the whole offset (+0105, -0030), as RFC 2822 §3.3 requires.
  • Null tick returns INVALID_POINTER and offsets outside ±1439 minutes return INVALID_VALUE, the same contract as the existing sceRtcFormatRFC3339 on main. shadPS4 formats the current time for a null tick and has no range check. A tick that overflows after adding the offset returns INVALID_VALUE (shadPS4 returns OK and writes nothing).
  • Local time uses the host offset at the given instant, the same as sceRtcConvertUtcToLocalTime on main. shadPS4 uses sceKernelGettimezone, which gives the current offset.

All of this is listed under TechnicalDebt "Unknown function info".

Tested

Linux, guest_rtc (extended):

  • RFC 2822 output for offsets 0, ±90/-300, -30, 65 and ±1439 (day rollover).
  • All seven weekdays, tick 0 (Mon, 01 Jan 0001) and the max tick (Fri, 31 Dec 9999). The expected strings come from Python datetime.
  • Overflow at both ends, out-of-range offsets with the buffer left untouched, and null pointers.
  • Both local-time variants under TZ set to +05:30, -03:00 and UTC.

On main the test doesn't link because the exports don't exist. 8 mutants (weekday index, month index, sign, padding, local offset, range check, overflow check, null guard) each make it fail. Full Release build (GCC) plus ctest -R 'guest_|rtc': 117/117 pass. merge-tree against #782 and #803 (other Rtc PRs of mine) is clean.

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:4754550708 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/804). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-06T05:28:02Z. --- ### What Implements three libSceRtc formatters that `main` did not declare at all (NIDs `eiuobaF-hK4`, `AxHBk3eat04`, `DwuHIlLGW8I`): - `sceRtcFormatRFC2822(buf, utc, minutes)`: `Thu, 29 Feb 2024 14:04:56 +0130` (weekday, two-digit day, month name, four-digit year, `±HHMM`; `+0000` for 0). - `sceRtcFormatRFC2822LocalTime(buf, utc)` and `sceRtcFormatRFC3339LocalTime(buf, utc)`: the same formatters (the existing `sceRtcFormatRFC3339` for the latter) with the host's local offset. Reference: shadPS4 `rtc.cpp` is the only body (fpPS4 has them as TODO, SharpProspero has signatures only). Where we differ from it: - Zone suffix: shadPS4 prints the minutes without padding (`+015` for 65 minutes) and takes the sign from the hours, so -30 comes out as `+030`. Here it is `%02d%02d` with the sign of the whole offset (`+0105`, `-0030`), as RFC 2822 §3.3 requires. - Null tick returns `INVALID_POINTER` and offsets outside ±1439 minutes return `INVALID_VALUE`, the same contract as the existing `sceRtcFormatRFC3339` on `main`. shadPS4 formats the current time for a null tick and has no range check. A tick that overflows after adding the offset returns `INVALID_VALUE` (shadPS4 returns OK and writes nothing). - Local time uses the host offset at the given instant, the same as `sceRtcConvertUtcToLocalTime` on `main`. shadPS4 uses `sceKernelGettimezone`, which gives the current offset. All of this is listed under TechnicalDebt "Unknown function info". ### Tested Linux, `guest_rtc` (extended): - RFC 2822 output for offsets 0, ±90/-300, -30, 65 and ±1439 (day rollover). - All seven weekdays, tick 0 (`Mon, 01 Jan 0001`) and the max tick (`Fri, 31 Dec 9999`). The expected strings come from Python `datetime`. - Overflow at both ends, out-of-range offsets with the buffer left untouched, and null pointers. - Both local-time variants under `TZ` set to +05:30, -03:00 and UTC. On `main` the test doesn't link because the exports don't exist. 8 mutants (weekday index, month index, sign, padding, local offset, range check, overflow check, null guard) each make it fail. Full Release build (GCC) plus `ctest -R 'guest_|rtc'`: 117/117 pass. `merge-tree` against #782 and #803 (other Rtc PRs of mine) is clean. ### 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 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-06 05:28:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-06T05:28:22Z.


Progress report (109a328 → 3515ead)

📈 System libraries: 82.32% (+0.02%, +3 implemented functions)

✅ 3 implemented
Library Name
libSceRtc sceRtcFormatRFC2822
libSceRtc sceRtcFormatRFC2822LocalTime
libSceRtc sceRtcFormatRFC3339LocalTime
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6010001079 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/804#issuecomment-6010001079). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-06T05:28:22Z. --- <!-- progress-report --> ### Progress report (109a328 → 3515ead) 📈 **System libraries**: 82.32% (+0.02%, +3 implemented functions) <details> <summary>✅ 3 implemented</summary> | Library | Name | | - | - | | libSceRtc | `sceRtcFormatRFC2822` | | libSceRtc | `sceRtcFormatRFC2822LocalTime` | | libSceRtc | `sceRtcFormatRFC3339LocalTime` | </details>
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!804
No description provided.