Make RTC tests pass

This commit is contained in:
kev :) 2012-11-11 00:33:16 +00:00
parent ba63a4ea2a
commit b9ff4295e7
4 changed files with 41 additions and 3 deletions

View File

@ -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"},

View File

@ -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()");

View File

@ -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);

View File

@ -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",