From 53a8ca52b620d6055e136ed5e2bcd590f5b09082 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Tue, 25 Aug 2009 06:34:58 +0000 Subject: GUI: Fixed the render-to-main fullscreen mode and screen resizing git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4056 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Timer.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (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 01da93bf9d..731f4095ac 100644 --- a/Source/Core/Common/Src/Timer.cpp +++ b/Source/Core/Common/Src/Timer.cpp @@ -191,7 +191,6 @@ std::string Timer::GetTimeFormatted() strftime(tmp, 6, "%M:%S", gmTime); - // Now tack on the milliseconds struct timeb tp; (void)::ftime(&tp); @@ -200,4 +199,29 @@ std::string Timer::GetTimeFormatted() return std::string(formattedTime); } + +// Returns a timestamp with decimals for precise time comparisons +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +double Timer::GetDoubleTime() +{ + struct timeb tp; + (void)::ftime(&tp); + u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continous timestamp + + /* Remove a few years. We only really want enough seconds to make sure that we are + detecting actual actions, perhaps 60 seconds is enough really, but I leave a + year of seconds anyway, in case the user's clock is incorrect or something like that */ + TmpSeconds = TmpSeconds - (38 * 365 * 24 * 60 * 60); + + //if (TmpSeconds < 0) return 0; // Check the the user's clock is working somewhat + + u32 Seconds = (u32)TmpSeconds; // Make a smaller integer that fits in the double + double ms = tp.millitm / 1000.0; + double TmpTime = Seconds + ms; + return TmpTime; +} + + } // Namespace Common + + -- cgit v1.2.3