summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/Timer.cpp
diff options
context:
space:
mode:
authorPerfectInduction <PerfectInduction@gmail.com>2010-08-26 19:24:47 +0000
committerPerfectInduction <PerfectInduction@gmail.com>2010-08-26 19:24:47 +0000
commitaae0e966826cffa37501e6dfc648d8617fbe618b (patch)
tree3e52ba90a50f8ba0f57e7115d5ddb8463b434b5f /Source/Core/Common/Src/Timer.cpp
parentd082f50c3444594c61cc9b6146fdfd95eeaa3313 (diff)
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
Diffstat (limited to 'Source/Core/Common/Src/Timer.cpp')
-rw-r--r--Source/Core/Common/Src/Timer.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/Core/Common/Src/Timer.cpp b/Source/Core/Common/Src/Timer.cpp
index 039770ebd7..67bb6874b4 100644
--- a/Source/Core/Common/Src/Timer.cpp
+++ b/Source/Core/Common/Src/Timer.cpp
@@ -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