mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user