Ejemplo n.º 1
0
static u32 sceRtcGetCurrentClockLocalTime(u32 pspTimePtr)
{
	DEBUG_LOG(SCERTC, "sceRtcGetCurrentClockLocalTime(%08x)", pspTimePtr);
	PSPTimeval tv;
	__RtcTimeOfDay(&tv);

	time_t sec = (time_t) tv.tv_sec;
	tm *local = localtime(&sec);
	if (!local)
	{
		ERROR_LOG(SCERTC, "Date is too high/low to handle, pretending to work.");
		return 0;
	}

	ScePspDateTime ret;
	__RtcTmToPspTime(ret, local);
	ret.microsecond = tv.tv_usec;

	if (Memory::IsValidAddress(pspTimePtr))
		Memory::WriteStruct(pspTimePtr, &ret);

	hleEatCycles(2000);
	hleReSchedule("rtc current clock local");
	return 0;
}
Ejemplo n.º 2
0
u32 sceRtcGetCurrentClock(u32 pspTimePtr, int tz)
{
	DEBUG_LOG(HLE, "sceRtcGetCurrentClock(%08x, %d)", pspTimePtr, tz);
	PSPTimeval tv;
	__RtcTimeOfDay(&tv);

	time_t sec = (time_t) tv.tv_sec;
	tm *utc = gmtime(&sec);
	if (!utc)
	{
		ERROR_LOG(HLE, "Date is too high/low to handle, pretending to work.");
		return 0;
	}

	utc->tm_isdst = -1;
	utc->tm_min += tz;
	rtc_timegm(utc); // Return gmt time with timezone offset.

	ScePspDateTime ret;
	__RtcTmToPspTime(ret, utc);
	ret.microsecond = tv.tv_usec;

	if (Memory::IsValidAddress(pspTimePtr))
		Memory::WriteStruct(pspTimePtr, &ret);

	hleEatCycles(1900);
	return 0;
}
Ejemplo n.º 3
0
u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr)
{
	// TODO: tzAddr?
	if (Memory::IsValidAddress(timeAddr))
	{
		timeval *tv = (timeval *)Memory::GetPointer(timeAddr);
		__RtcTimeOfDay(tv);
	}

	DEBUG_LOG(HLE,"sceKernelLibcGettimeofday(%08x, %08x)", timeAddr, tzAddr);
	hleEatCycles(1885);
    return 0;
}
Ejemplo n.º 4
0
u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr)
{
	// TODO: tzAddr?
	if (Memory::IsValidAddress(timeAddr))
	{
		PSPTimeval *tv = (PSPTimeval *)Memory::GetPointer(timeAddr);
		__RtcTimeOfDay(tv);
	}

	DEBUG_LOG(SCEKERNEL,"sceKernelLibcGettimeofday(%08x, %08x)", timeAddr, tzAddr);
	hleEatCycles(1885);

	hleReSchedule("libc timeofday");
	return 0;
}