diff options
-rw-r--r-- | compat/sleep.hpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compat/sleep.hpp b/compat/sleep.hpp index fab27286..4cd7a397 100644 --- a/compat/sleep.hpp +++ b/compat/sleep.hpp @@ -9,14 +9,16 @@ namespace portable { #ifdef _WIN32 - inline void sleep(unsigned milliseconds) + inline void sleep(int milliseconds) { - Sleep(milliseconds); + if (milliseconds > 0) + Sleep(milliseconds); } #else - inline void sleep(unsigned milliseconds) + inline void sleep(int milliseconds) { - usleep(milliseconds * 1000U); // takes microseconds + if (milliseconds > 0) + usleep(unsigned(milliseconds) * 1000U); // takes microseconds } #endif } |