Repository navigation
feat(rtc): parse RFC 2822 and asctime strings in sceRtcParseDateTime - #782
Conversation
|
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 It needs a one-line rebase now: |
Co-Authored-By: Claude <noreply@anthropic.com>
|
Rebased on current |
d34c315 to
4e5a1fe
Compare
|
Dropping a test idea here per oneandonlydean's suggestion (from the #816 review): a cross-check row tying the two parsers together — |
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)