Fix RTC to report the correct system time in Wii and GC titles as reported in Issue 1817

Modify GetLocalTimeSinceJan1970 to account for DST.
GetGCTime() returns only GC epoch time(used by most Wii titles.)
IPL-DEV subtracts Wii bias before copying to m_RTC(mostly used by homebrew.)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6133 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
PerfectInduction
2010-08-26 19:24:47 +00:00
parent d082f50c34
commit aae0e96682
2 changed files with 17 additions and 9 deletions

View File

@ -174,15 +174,23 @@ u64 Timer::GetTimeSinceJan1970()
u64 Timer::GetLocalTimeSinceJan1970()
{
time_t sysTime, tzDiff;
time_t sysTime, tzDiff, tzDST;
struct tm * gmTime;
time(&sysTime);
// Account for DST where needed
gmTime = localtime(&sysTime);
if(gmTime->tm_isdst == 1)
tzDST = 3600;
else
tzDST = 0;
// Lazy way to get local time in sec
gmTime = gmtime(&sysTime);
tzDiff = sysTime - mktime(gmTime);
return (u64)(sysTime + tzDiff);
return (u64)(sysTime + tzDiff + tzDST);
}
// Return the current time formatted as Minutes:Seconds:Milliseconds