diff options
| author | memberTwo.mb2 <memberTwo.mb2@gmail.com> | 2008-12-13 11:57:01 +0000 |
|---|---|---|
| committer | memberTwo.mb2 <memberTwo.mb2@gmail.com> | 2008-12-13 11:57:01 +0000 |
| commit | 82cd659638c5e1c110c869ffcb58e52ae2d67184 (patch) | |
| tree | ce84bf7ad030d7b791e1a845291bb822a92951c7 /Source/Core/Common/Src/Timer.cpp | |
| parent | d1712f15ca71687ecff0ad823f39726b2e941481 (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/Src/Timer.cpp')
| -rw-r--r-- | Source/Core/Common/Src/Timer.cpp | 13 |
1 files changed, 13 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(<ime); 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 |
