From ba422bd78ec0d78611d0bced54c98d80da20a18d Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Sun, 28 Dec 2014 13:13:21 -0500 Subject: systemtime: Add function wrapping platform sleep function Adds systemtime_msleep() which sleeps for a number of milliseconds. This wraps Sleep() on windows and usleep() on other platforms. --- src/systemtime.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/systemtime.c') diff --git a/src/systemtime.c b/src/systemtime.c index 84106c5..0d0cb85 100644 --- a/src/systemtime.c +++ b/src/systemtime.c @@ -68,3 +68,14 @@ systemtime_get_time(double *t) return 0; } + +/* Sleep for a number of milliseconds. */ +void +systemtime_msleep(unsigned int msecs) +{ +#ifndef _WIN32 + usleep(msecs*1000); +#else + Sleep(msecs); +#endif +} -- cgit v1.2.3-70-g09d2