summaryrefslogtreecommitdiff
path: root/src/SFML/System/Win32/SleepImpl.cpp
diff options
context:
space:
mode:
authorJames Cowgill <james410@cowgill.org.uk>2014-12-09 20:21:40 +0000
committerJames Cowgill <james410@cowgill.org.uk>2014-12-09 20:21:40 +0000
commitfa21c65d0c764705cfc377bf0d0de08fac26874e (patch)
treedbc9e87bbd8684d15e79fc0c8b7a8985389c3b35 /src/SFML/System/Win32/SleepImpl.cpp
parentdd835931261c340acd5f0409341d13fa2670423e (diff)
Imported Upstream version 2.2.0+dfsg
Diffstat (limited to 'src/SFML/System/Win32/SleepImpl.cpp')
-rw-r--r--src/SFML/System/Win32/SleepImpl.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/SFML/System/Win32/SleepImpl.cpp b/src/SFML/System/Win32/SleepImpl.cpp
index c3acda6..6f7106f 100644
--- a/src/SFML/System/Win32/SleepImpl.cpp
+++ b/src/SFML/System/Win32/SleepImpl.cpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -36,7 +36,18 @@ namespace priv
////////////////////////////////////////////////////////////
void sleepImpl(Time time)
{
+ // Get the supported timer resolutions on this system
+ TIMECAPS tc;
+ timeGetDevCaps(&tc, sizeof(TIMECAPS));
+
+ // Set the timer resolution to the minimum for the Sleep call
+ timeBeginPeriod(tc.wPeriodMin);
+
+ // Wait...
::Sleep(time.asMilliseconds());
+
+ // Reset the timer resolution back to the system default
+ timeEndPeriod(tc.wPeriodMin);
}
} // namespace priv