summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorJohn Peterson <jpeterson57@gmail.com>2009-08-25 06:34:58 +0000
committerJohn Peterson <jpeterson57@gmail.com>2009-08-25 06:34:58 +0000
commit53a8ca52b620d6055e136ed5e2bcd590f5b09082 (patch)
tree23afd08070bdb2edf66170de3ba1f7e3a5a83693 /Source/Core/Common
parent6b8b576bab37357a554f413e3bd80e8cf9f3db85 (diff)
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
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/Timer.cpp26
-rw-r--r--Source/Core/Common/Src/Timer.h1
2 files changed, 26 insertions, 1 deletions
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
+
+
diff --git a/Source/Core/Common/Src/Timer.h b/Source/Core/Common/Src/Timer.h
index 82d384b2b1..c457bf0fab 100644
--- a/Source/Core/Common/Src/Timer.h
+++ b/Source/Core/Common/Src/Timer.h
@@ -44,6 +44,7 @@ public:
static void RestoreResolution();
static u64 GetTimeSinceJan1970();
static u64 GetLocalTimeSinceJan1970();
+ static double GetDoubleTime();
static std::string GetTimeFormatted();
std::string GetTimeElapsedFormatted() const;