summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authormemberTwo.mb2 <memberTwo.mb2@gmail.com>2008-12-13 11:57:01 +0000
committermemberTwo.mb2 <memberTwo.mb2@gmail.com>2008-12-13 11:57:01 +0000
commit82cd659638c5e1c110c869ffcb58e52ae2d67184 (patch)
treece84bf7ad030d7b791e1a845291bb822a92951c7 /Source/Core/Common
parentd1712f15ca71687ecff0ad823f39726b2e941481 (diff)
Fix time in some games (AC and ZWW at least). Many games doesn't use RTC but TBRs. So a TB offset is initialized at boot with localtime now. There are, indeed, side effects since time is CPU cycle dependent in this case.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1519 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/Timer.cpp13
-rw-r--r--Source/Core/Common/Src/Timer.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/Source/Core/Common/Src/Timer.cpp b/Source/Core/Common/Src/Timer.cpp
index 152d664416..6e59ea0a89 100644
--- a/Source/Core/Common/Src/Timer.cpp
+++ b/Source/Core/Common/Src/Timer.cpp
@@ -96,4 +96,17 @@ u64 Timer::GetTimeSinceJan1970(void)
time(&ltime);
return((u64)ltime);
}
+
+u64 Timer::GetLocalTimeSinceJan1970(void)
+{
+ time_t sysTime, tzDiff;
+ struct tm * gmTime;
+
+ time(&sysTime);
+ // Lazy way to get local time in sec
+ gmTime = gmtime(&sysTime);
+ tzDiff = sysTime - mktime(gmTime);
+
+ return (u64)(sysTime + tzDiff);
+}
} // end of namespace Common
diff --git a/Source/Core/Common/Src/Timer.h b/Source/Core/Common/Src/Timer.h
index 4be5ab07d1..64791ab38a 100644
--- a/Source/Core/Common/Src/Timer.h
+++ b/Source/Core/Common/Src/Timer.h
@@ -37,6 +37,7 @@ class Timer
static void IncreaseResolution();
static void RestoreResolution();
static u64 GetTimeSinceJan1970();
+ static u64 GetLocalTimeSinceJan1970();
public: