mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-10 00:05:07 +00:00
Make RTC tests pass
This commit is contained in:
parent
ba63a4ea2a
commit
b9ff4295e7
@ -104,8 +104,8 @@ const HLEFunction sceRtc[] =
|
||||
{0x34885E0D, 0, "sceRtcConvertUtcToLocalTime"},
|
||||
{0x779242A2, 0, "sceRtcConvertLocalTimeToUTC"},
|
||||
{0x42307A17, 0, "sceRtcIsLeapYear"},
|
||||
{0x05ef322c, 0, "sceRtcGetDaysInMonth"},
|
||||
{0x57726bc1, 0, "sceRtcGetDayOfWeek"},
|
||||
{0x05ef322c, &WrapU_UU<sceRtcGetDaysInMonth>, "sceRtcGetDaysInMonth"},
|
||||
{0x57726bc1, &WrapU_UUU<sceRtcGetDayOfWeek>, "sceRtcGetDayOfWeek"},
|
||||
{0x4B1B5E82, 0, "sceRtcCheckValid"},
|
||||
{0x3a807cc8, 0, "sceRtcSetTime_t"},
|
||||
{0x27c4594c, 0, "sceRtcGetTime_t"},
|
||||
|
@ -150,6 +150,42 @@ void sceRtcGetTick()
|
||||
RETURN(0);
|
||||
}
|
||||
|
||||
u32 sceRtcGetDayOfWeek(u32 year, u32 month, u32 day)
|
||||
{
|
||||
static u32 t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };
|
||||
|
||||
year -= month < 3;
|
||||
return ( year + year/4 - year/100 + year/400 + t[month-1] + day) % 7;
|
||||
}
|
||||
|
||||
u32 sceRtcGetDaysInMonth(u32 year, u32 month)
|
||||
{
|
||||
DEBUG_LOG(HLE,"0=sceRtcGetDaysInMonth()");
|
||||
u32 numberOfDays;
|
||||
|
||||
switch (month)
|
||||
{
|
||||
case 4:
|
||||
case 6:
|
||||
case 9:
|
||||
case 11:
|
||||
numberOfDays = 30;
|
||||
break;
|
||||
case 2:
|
||||
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
|
||||
numberOfDays = 29;
|
||||
else
|
||||
numberOfDays = 28;
|
||||
break;
|
||||
|
||||
default:
|
||||
numberOfDays = 31;
|
||||
break;
|
||||
}
|
||||
|
||||
return numberOfDays;
|
||||
}
|
||||
|
||||
void sceRtcGetTickResolution()
|
||||
{
|
||||
DEBUG_LOG(HLE,"100=sceRtcGetTickResolution()");
|
||||
|
@ -29,3 +29,5 @@ void sceKernelSysClock2USecWide();
|
||||
void sceRtcGetCurrentClockLocalTime();
|
||||
void sceRtcGetTickResolution();
|
||||
void sceRtcGetTick();
|
||||
u32 sceRtcGetDaysInMonth(u32 year, u32 month);
|
||||
u32 sceRtcGetDayOfWeek(u32 year, u32 month, u32 day);
|
2
test.py
2
test.py
@ -26,6 +26,7 @@ tests_good = [
|
||||
"string/string",
|
||||
"gpu/callbacks/ge_callbacks",
|
||||
"threads/mbx/mbx",
|
||||
"rtc/rtc",
|
||||
]
|
||||
|
||||
# These are the next tests up for fixing.
|
||||
@ -44,7 +45,6 @@ tests_next = [
|
||||
"mstick/mstick",
|
||||
"modules/loadexec/loader",
|
||||
"power/power",
|
||||
"rtc/rtc",
|
||||
"sysmem/sysmem",
|
||||
"threads/events/events",
|
||||
"threads/fpl/fpl",
|
||||
|
Loading…
x
Reference in New Issue
Block a user