diff options
Diffstat (limited to 'compat/sleep.cpp')
-rw-r--r-- | compat/sleep.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compat/sleep.cpp b/compat/sleep.cpp new file mode 100644 index 00000000..6a22adeb --- /dev/null +++ b/compat/sleep.cpp @@ -0,0 +1,21 @@ +#include "sleep.hpp" + +#ifdef _WIN32 +# include <windows.h> +#else +# include <unistd.h> +#endif + +namespace portable +{ + OTR_COMPAT_EXPORT void sleep(int milliseconds) + { + if (milliseconds > 0) +#ifdef _WIN32 + + Sleep(milliseconds); +#else + usleep(unsigned(milliseconds) * 1000U); // takes microseconds +#endif + } +} |