diff --git a/core/libs/prx/libSceRtc/Export.cpp b/core/libs/prx/libSceRtc/Export.cpp index 91c6591395..b53df446cf 100644 --- a/core/libs/prx/libSceRtc/Export.cpp +++ b/core/libs/prx/libSceRtc/Export.cpp @@ -534,90 +534,6 @@ int APS5_VABI sceRtcSetDosTime(RtcDateTime* time, uint32_t dos_time) { return 0; } -int APS5_VABI sceRtcGetYear(const RtcDateTime* time) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - return static_cast(time->year); -} - -int APS5_VABI sceRtcSetYear(RtcDateTime* time, int year) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - if (year < 1 || year > 9999) return SCE_RTC_ERROR_INVALID_YEAR; - time->year = static_cast(year); - return 0; -} - -int APS5_VABI sceRtcGetMonth(const RtcDateTime* time) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - return static_cast(time->month); -} - -int APS5_VABI sceRtcSetMonth(RtcDateTime* time, int month) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - if (month < 1 || month > 12) return SCE_RTC_ERROR_INVALID_MONTH; - time->month = static_cast(month); - return 0; -} - -int APS5_VABI sceRtcGetDay(const RtcDateTime* time) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - return static_cast(time->day); -} - -int APS5_VABI sceRtcSetDay(RtcDateTime* time, int day) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - if (day < 1 || day > 31) return SCE_RTC_ERROR_INVALID_DAY; - time->day = static_cast(day); - return 0; -} - -int APS5_VABI sceRtcGetHour(const RtcDateTime* time) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - return static_cast(time->hour); -} - -int APS5_VABI sceRtcSetHour(RtcDateTime* time, int hour) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - if (hour < 0 || hour > 23) return SCE_RTC_ERROR_INVALID_HOUR; - time->hour = static_cast(hour); - return 0; -} - -int APS5_VABI sceRtcGetMinute(const RtcDateTime* time) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - return static_cast(time->minute); -} - -int APS5_VABI sceRtcSetMinute(RtcDateTime* time, int minute) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - if (minute < 0 || minute > 59) return SCE_RTC_ERROR_INVALID_MINUTE; - time->minute = static_cast(minute); - return 0; -} - -int APS5_VABI sceRtcGetSecond(const RtcDateTime* time) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - return static_cast(time->second); -} - -int APS5_VABI sceRtcSetSecond(RtcDateTime* time, int second) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - if (second < 0 || second > 59) return SCE_RTC_ERROR_INVALID_SECOND; - time->second = static_cast(second); - return 0; -} - -int APS5_VABI sceRtcGetMicrosecond(const RtcDateTime* time) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - return static_cast(time->microsecond); -} - -int APS5_VABI sceRtcSetMicrosecond(RtcDateTime* time, int microsecond) { - if (!time) return SCE_RTC_ERROR_INVALID_POINTER; - if (microsecond < 0 || static_cast(microsecond) >= TICKS_PER_SECOND) return SCE_RTC_ERROR_INVALID_MICROSECOND; - time->microsecond = static_cast(microsecond); - return 0; -} - int APS5_VABI sceRtcFormatRFC3339(char* dateTime, const RtcTick* utc, int timeZoneMinutes) { if (!dateTime) return SCE_RTC_ERROR_INVALID_POINTER; RtcTick now{}; diff --git a/core/libs/prx/libSceRtc/include/Rtc.hpp b/core/libs/prx/libSceRtc/include/Rtc.hpp index 7e84acf6b7..2e570dc02b 100644 --- a/core/libs/prx/libSceRtc/include/Rtc.hpp +++ b/core/libs/prx/libSceRtc/include/Rtc.hpp @@ -23,20 +23,6 @@ int APS5_VABI sceRtcGetWin32FileTime(const RtcDateTime* time, uint64_t* win32Tim int APS5_VABI sceRtcSetWin32FileTime(RtcDateTime* time, uint64_t win32Time); int APS5_VABI sceRtcGetDosTime(const RtcDateTime* time, uint32_t* dosTime); int APS5_VABI sceRtcSetDosTime(RtcDateTime* time, uint32_t dosTime); -int APS5_VABI sceRtcGetYear(const RtcDateTime* time); -int APS5_VABI sceRtcSetYear(RtcDateTime* time, int year); -int APS5_VABI sceRtcGetMonth(const RtcDateTime* time); -int APS5_VABI sceRtcSetMonth(RtcDateTime* time, int month); -int APS5_VABI sceRtcGetDay(const RtcDateTime* time); -int APS5_VABI sceRtcSetDay(RtcDateTime* time, int day); -int APS5_VABI sceRtcGetHour(const RtcDateTime* time); -int APS5_VABI sceRtcSetHour(RtcDateTime* time, int hour); -int APS5_VABI sceRtcGetMinute(const RtcDateTime* time); -int APS5_VABI sceRtcSetMinute(RtcDateTime* time, int minute); -int APS5_VABI sceRtcGetSecond(const RtcDateTime* time); -int APS5_VABI sceRtcSetSecond(RtcDateTime* time, int second); -int APS5_VABI sceRtcGetMicrosecond(const RtcDateTime* time); -int APS5_VABI sceRtcSetMicrosecond(RtcDateTime* time, int microsecond); int APS5_VABI sceRtcFormatRFC3339(char* dateTime, const RtcTick* utc, int timeZoneMinutes); int APS5_VABI sceRtcFormatRFC3339LocalTime(char* dateTime, const RtcTick* utc); int APS5_VABI sceRtcFormatRFC2822(char* dateTime, const RtcTick* utc, int timeZoneMinutes); diff --git a/core/libs/tests/GuestRtc.cpp b/core/libs/tests/GuestRtc.cpp index 8d9b302b49..acd20cdd19 100644 --- a/core/libs/tests/GuestRtc.cpp +++ b/core/libs/tests/GuestRtc.cpp @@ -187,58 +187,6 @@ int main(int argc, char** argv) { const RtcDateTime dosLate{2108, 1, 1, 0, 0, 0, 0}; Require(sceRtcGetDosTime(&dosLate, &dosTime) == invalidYear && dosTime == 0xff9fbf7du); - Require(sceRtcGetYear(nullptr) == invalidPointer); - Require(sceRtcSetYear(nullptr, 2024) == invalidPointer); - Require(sceRtcSetYear(&converted, 0) == invalidYear); - Require(sceRtcSetYear(&converted, 10000) == invalidYear); - Require(sceRtcSetYear(&converted, 1) == 0 && sceRtcGetYear(&converted) == 1); - Require(sceRtcSetYear(&converted, 9999) == 0 && sceRtcGetYear(&converted) == 9999); - Require(sceRtcSetYear(&converted, 2026) == 0 && sceRtcGetYear(&converted) == 2026); - - Require(sceRtcGetMonth(nullptr) == invalidPointer); - Require(sceRtcSetMonth(nullptr, 6) == invalidPointer); - Require(sceRtcSetMonth(&converted, 0) == invalidMonth); - Require(sceRtcSetMonth(&converted, 13) == invalidMonth); - Require(sceRtcSetMonth(&converted, 1) == 0 && sceRtcGetMonth(&converted) == 1); - Require(sceRtcSetMonth(&converted, 12) == 0 && sceRtcGetMonth(&converted) == 12); - - Require(sceRtcGetDay(nullptr) == invalidPointer); - Require(sceRtcSetDay(nullptr, 15) == invalidPointer); - Require(sceRtcSetDay(&converted, 0) == invalidDay); - Require(sceRtcSetDay(&converted, 32) == invalidDay); - Require(sceRtcSetDay(&converted, 1) == 0 && sceRtcGetDay(&converted) == 1); - Require(sceRtcSetDay(&converted, 31) == 0 && sceRtcGetDay(&converted) == 31); - - Require(sceRtcGetHour(nullptr) == invalidPointer); - Require(sceRtcSetHour(nullptr, 12) == invalidPointer); - Require(sceRtcSetHour(&converted, -1) == invalidHour); - Require(sceRtcSetHour(&converted, 24) == invalidHour); - Require(sceRtcSetHour(&converted, 0) == 0 && sceRtcGetHour(&converted) == 0); - Require(sceRtcSetHour(&converted, 23) == 0 && sceRtcGetHour(&converted) == 23); - - constexpr int invalidMinute = static_cast(0x80B5000C); - constexpr int invalidSecond = static_cast(0x80B5000D); - - Require(sceRtcGetMinute(nullptr) == invalidPointer); - Require(sceRtcSetMinute(nullptr, 30) == invalidPointer); - Require(sceRtcSetMinute(&converted, -1) == invalidMinute); - Require(sceRtcSetMinute(&converted, 60) == invalidMinute); - Require(sceRtcSetMinute(&converted, 0) == 0 && sceRtcGetMinute(&converted) == 0); - Require(sceRtcSetMinute(&converted, 59) == 0 && sceRtcGetMinute(&converted) == 59); - - Require(sceRtcGetSecond(nullptr) == invalidPointer); - Require(sceRtcSetSecond(nullptr, 45) == invalidPointer); - Require(sceRtcSetSecond(&converted, -1) == invalidSecond); - Require(sceRtcSetSecond(&converted, 60) == invalidSecond); - Require(sceRtcSetSecond(&converted, 0) == 0 && sceRtcGetSecond(&converted) == 0); - Require(sceRtcSetSecond(&converted, 59) == 0 && sceRtcGetSecond(&converted) == 59); - - Require(sceRtcGetMicrosecond(nullptr) == invalidPointer); - Require(sceRtcSetMicrosecond(nullptr, 123456) == invalidPointer); - Require(sceRtcSetMicrosecond(&converted, -1) == invalidMicrosecond); - Require(sceRtcSetMicrosecond(&converted, 1000000) == invalidMicrosecond); - Require(sceRtcSetMicrosecond(&converted, 0) == 0 && sceRtcGetMicrosecond(&converted) == 0); - Require(sceRtcSetMicrosecond(&converted, 999999) == 0 && sceRtcGetMicrosecond(&converted) == 999999); converted = RtcDateTime{1, 1, 1, 1, 1, 1, 1}; Require(sceRtcSetDosTime(&converted, 0x585d645cu) == 0 && Equal(converted, RtcDateTime{2024, 2, 29, 12, 34, 56, 0})); Require(sceRtcSetDosTime(&converted, 0x7f9fbf7du) == 0 && Equal(converted, RtcDateTime{2043, 12, 31, 23, 59, 58, 0})); diff --git a/docs/dev/debt/libSceRtc.md b/docs/dev/debt/libSceRtc.md index 12645457b4..9daf5615bd 100644 --- a/docs/dev/debt/libSceRtc.md +++ b/docs/dev/debt/libSceRtc.md @@ -15,7 +15,6 @@ - [sceRtcGetCurrentAdNetworkTick, sceRtcGetCurrentDebugNetworkTick](../../../core/libs/prx/libSceRtc/Export.cpp) (libSceRtc) - the console reads clocks 0x12 and 0x11 and falls back to network clock 0x10 when either clock is unsupported. These getters use their process-local clock when it was set, otherwise they follow the process-local network clock. The firmware's unsupported-clock result is not modelled. Read from the disassembly of libSceRtc.sprx on firmware 13.60, not measured on a console - [sceRtcSetCurrentTick, sceRtcSetCurrentNetworkTick, sceRtcSetCurrentAdNetworkTick, sceRtcSetCurrentDebugNetworkTick](../../../core/libs/prx/libSceRtc/Export.cpp) (libSceRtc) - a valid tick sets a process-local clock that advances from a monotonic host clock; the host system clock is not changed. The console sets clock 0, 0x10, 0x12 or 0x11. Null pointers return `0x80B50002` and ticks before the Unix epoch return `0x80B50003`, from disassembly of libSceRtc.sprx on firmware 13.60, not measured on a console. sceRtcSetConf passes its third and fourth arguments to the same clock call with clock 0 and throws; what the pair selects is unknown - [sceRtcFormatRFC3339Precise, sceRtcFormatRFC3339PreciseLocalTime](../../../core/libs/prx/libSceRtc/Export.cpp) (libSceRtc) - read from the disassembly of libSceRtc.sprx on firmware 13.60: a null tick means the current tick, a precision above 6 or a zone outside -1439 to 1439 minutes returns `0x80B50003`, and the fraction is the microseconds truncated to the requested number of digits. Not compared with console output. The output buffer size is unknown; at most 33 bytes are written -- [sceRtcGetYear, sceRtcGetMonth, sceRtcGetDay, sceRtcGetHour, sceRtcGetMinute, sceRtcGetSecond, sceRtcGetMicrosecond, sceRtcSetYear, sceRtcSetMonth, sceRtcSetDay, sceRtcSetHour, sceRtcSetMinute, sceRtcSetSecond, sceRtcSetMicrosecond](../../../core/libs/prx/libSceRtc/Export.cpp) (libSceRtc) - inferred component behavior without confirmed hardware trace. Component setters validate individual boundaries (e.g. day 1..31) independently without cross-field calendar validation; getters return `0x80B50002` (`SCE_RTC_ERROR_INVALID_POINTER`) for a null pointer ### Functional