summaryrefslogtreecommitdiffhomepage
path: root/opentrack-compat/sleep.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-25 11:43:10 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-25 11:43:10 +0200
commit10ac081b3c4ebb9b29b81b30f5efe6622f4212bc (patch)
treefedfe7efc494145d0b46e91ba5a94c47cb0c1b6f /opentrack-compat/sleep.hpp
parent6baa8ca1070612e5d7cbae7aa62cbe4a9e51ad40 (diff)
parent24538cf3a3a91481851618791b11be81437563e4 (diff)
Merge branch 'unstable' into trackhat-ui
Diffstat (limited to 'opentrack-compat/sleep.hpp')
-rw-r--r--opentrack-compat/sleep.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/opentrack-compat/sleep.hpp b/opentrack-compat/sleep.hpp
new file mode 100644
index 00000000..27920842
--- /dev/null
+++ b/opentrack-compat/sleep.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+namespace portable
+{
+#ifdef _WIN32
+ #include <windows.h>
+
+ template<typename = void>
+ void sleep(unsigned milliseconds)
+ {
+ Sleep(milliseconds);
+ }
+#else
+ #include <unistd.h>
+
+ template<typename = void>
+ void sleep(unsigned milliseconds)
+ {
+ usleep(milliseconds * 1000U); // takes microseconds
+ }
+#endif
+}