feat(rtc): parse RFC 2822 and asctime strings in sceRtcParseDateTime #782
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/782"
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 adriadam10 on 2026-10-05T23:37:32Z.
What
sceRtcParseDateTime(#516) parses the ISO 8601 / RFC 3339 shape and throws for anything else. This adds the two other shapes shadPS4'ssceRtcParseDateTime(rtc.cpp) parses, the only reference with a body (KytyPS5 has none, fpPS4 is a TODO):Ddd, DD Mon YYYY HH:MM:SS, optionally followed by±HHMMorGMT.Ddd Mon DD HH:MM:SS YYYY, with the day zero- or space-padded.Behaviour that differs from shadPS4, or that it doesn't specify:
+HHMMoffset to get UTC, in both its RFC 2822 and RFC 3339 parsers, but its ownsceRtcFormatRFC2822/FormatRFC3339also add the offset to go from UTC to local time, so its parse and format don't round-trip. Here the offset is subtracted, like oursceRtcParseRFC3339and RFC 2822 itself.std::stoiand ignores anything else in the string. Here every separator is checked, and so are the month and weekday names. Any other suffix (such asPST,+01:30, a trailing\nor extra characters) throws throughNotImplemented_nid_no_patch, as the ISO path already does. ForGMTshadPS4 applies no offset, and this PR does the same.validate(for example, 30 Feb returnsSCE_RTC_ERROR_INVALID_DAY). The weekday name is not checked against the date, and shadPS4 doesn't check it either.The ISO path's behaviour is unchanged. It was moved into
parseIsoDateTimeso all three shapes share the validation, the tick conversion and the throw. The TechnicalDebt line now lists the accepted shapes and the sign choice.Tested
guest_rtcpasses. The full build, thelibstarget andctest -R 'guest_|rtc'(105 tests) all pass.GMT, with+0130and-0130, at the epoch, with a space-padded day and with an invalid day, plus 8 shapes that must throw. The expected values were checked with Python'semail.utils.parsedate_to_datetime/strptime. Onmainthe test fails because the RFC 2822 rows throw.GMT, an off-by-one month, no space-padded day, dropping the asctime or RFC 2822 path, no offset range check, and not checking the weekday.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T01:12:43Z.
Thanks, this looks right to me. The three parsers share the validation and tick conversion, the ISO path behaves as before, every separator and name is checked, and subtracting the
±HHMMoffset matchessceRtcParseRFC3339and RFC 2822 (and fixes shadPS4's round-trip problem rather than copying it). The new rows fail onmain, as you say.It needs a one-line rebase now:
docs/dev/TechnicalDebt.mdconflicts with currentmain, because #740 added thesceAudio3dPortOpenline directly under thesceRtcParseDateTimeline you rewrite. Keeping your version of the Rtc line and main's Audio3d line after it resolves it.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-06T05:16:16Z.
Rebased on current
main: kept the rewrittensceRtcParseDateTimeTechnicalDebt line with thesceAudio3dPortOpenline from #740 right after it.guest_rtcpasses.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-06T07:35:52Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/TechnicalDebt.mdL36Imported from boykopovar/AnyPS5. Originally posted by ebosido444-ai on 2026-10-06T09:41:56Z.
Dropping a test idea here per oneandonlydean's suggestion (from the #816 review): a cross-check row tying the two parsers together —
sceRtcParseDateTime("Tue, 01 Jul 2003 10:52:37 +0200")should equalsceRtcParseRFC3339("2003-07-01T08:52:37Z")(same instant, independent paths; the reference via ParseRFC3339 keeps it honest). A couple of rows like that in GuestRtc would lock the timezone-offset direction against exactly the class of slip I made in #816's TechnicalDebt line. Feel free to take or ignore.