From 82cd659638c5e1c110c869ffcb58e52ae2d67184 Mon Sep 17 00:00:00 2001 From: "memberTwo.mb2" Date: Sat, 13 Dec 2008 11:57:01 +0000 Subject: 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 --- Source/Core/Common/Src/Timer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Source/Core/Common/Src/Timer.cpp') 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 -- cgit v1.2.3