feat(rtc): implement libSceRtc date and tick functions #9

Merged
Pacuka merged 1 commit from upstream-pr/9 into main 2026-09-26 10:41:16 +00:00
Pacuka commented 2026-09-26 10:21:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pacuka on 2026-09-26T10:21:44Z.


All libSceRtc exports were NotImplemented stubs. The Smurfs – Dreams (Unreal Engine) calls them during startup. This is the second of the smaller library implementations after #8. It is independent of #8, and the two merge cleanly in either order.

Changes

  • Ticks count microseconds since 0001-01-01 00:00:00 in the proleptic Gregorian calendar, up to 9999-12-31 23:59:59.999999. sceRtcGetTickResolution returns 1000000.
  • Validation (sceRtcCheckValid, sceRtcIsLeapYear, sceRtcGetDayOfWeek) returns the matching SCE_RTC_ERROR_INVALID_* code (0x80B50002–0x80B5000E).
  • Conversions: sceRtcGetTick/SetTick, GetTime_t/SetTime_t, GetWin32FileTime/SetWin32FileTime.
  • Current time: sceRtcGetCurrentTick, GetCurrentClock, GetCurrentClockLocalTime. sceRtcGetCurrentNetworkTick uses the host clock.
  • UTC and local time conversion through the host time zone.
  • sceRtcFormatRFC3339 (YYYY-MM-DDThh:mm:ss.cc plus Z or ±hh:mm) and sceRtcParseRFC3339.
  • Tick arithmetic (sceRtcTickAdd*) rejects results outside the valid range with SCE_RTC_ERROR_INVALID_VALUE.
  • New exports: sceRtcGetDaysInMonth, sceRtcTickAddMonths and sceRtcTickAddYears. The last two clamp the day to the end of the target month (2024-01-31 + 1 month = 2024-02-29).
  • A guest_rtc test with known values: epoch ticks, leap years, day of week, time_t/FILETIME, the maximum tick, RFC 3339 round trips with positive and negative offsets, parse errors, month/year clamping, range errors, and a local ↔ UTC round trip.

Testing (Linux, GCC)

  • The full build and libs build succeed.
  • guest_rtc passes, including under TZ set to UTC, Europe/Budapest, America/New_York, Asia/Kolkata, Australia/Lord_Howe and Pacific/Chatham.
  • ctest: 23/29 pass; the 6 failures are the same pre-existing Linux failures listed in #7.
  • Not tested on Windows.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4646452140 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9). Originally posted by [Pacuka](https://github.com/Pacuka) on 2026-09-26T10:21:44Z. --- All `libSceRtc` exports were `NotImplemented` stubs. The Smurfs – Dreams (Unreal Engine) calls them during startup. This is the second of the smaller library implementations after #8. It is independent of #8, and the two merge cleanly in either order. Changes - Ticks count microseconds since 0001-01-01 00:00:00 in the proleptic Gregorian calendar, up to 9999-12-31 23:59:59.999999. `sceRtcGetTickResolution` returns 1000000. - Validation (`sceRtcCheckValid`, `sceRtcIsLeapYear`, `sceRtcGetDayOfWeek`) returns the matching `SCE_RTC_ERROR_INVALID_*` code (`0x80B50002`–`0x80B5000E`). - Conversions: `sceRtcGetTick`/`SetTick`, `GetTime_t`/`SetTime_t`, `GetWin32FileTime`/`SetWin32FileTime`. - Current time: `sceRtcGetCurrentTick`, `GetCurrentClock`, `GetCurrentClockLocalTime`. `sceRtcGetCurrentNetworkTick` uses the host clock. - UTC and local time conversion through the host time zone. - `sceRtcFormatRFC3339` (`YYYY-MM-DDThh:mm:ss.cc` plus `Z` or `±hh:mm`) and `sceRtcParseRFC3339`. - Tick arithmetic (`sceRtcTickAdd*`) rejects results outside the valid range with `SCE_RTC_ERROR_INVALID_VALUE`. - New exports: `sceRtcGetDaysInMonth`, `sceRtcTickAddMonths` and `sceRtcTickAddYears`. The last two clamp the day to the end of the target month (2024-01-31 + 1 month = 2024-02-29). - A `guest_rtc` test with known values: epoch ticks, leap years, day of week, time_t/FILETIME, the maximum tick, RFC 3339 round trips with positive and negative offsets, parse errors, month/year clamping, range errors, and a local ↔ UTC round trip. Testing (Linux, GCC) - The full build and libs build succeed. - `guest_rtc` passes, including under `TZ` set to UTC, Europe/Budapest, America/New_York, Asia/Kolkata, Australia/Lord_Howe and Pacific/Chatham. - ctest: 23/29 pass; the 6 failures are the same pre-existing Linux failures listed in #7. - Not tested on Windows. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!9
No description provided.