aboutsummaryrefslogtreecommitdiffstats
path: root/src/systemtime.c
diff options
context:
space:
mode:
authorJon Lund Steffensen <jonlst@gmail.com>2014-12-28 13:13:21 -0500
committerJon Lund Steffensen <jonlst@gmail.com>2014-12-28 13:13:21 -0500
commitba422bd78ec0d78611d0bced54c98d80da20a18d (patch)
treeaf86a219f177b1d45a2bcd58cceb87b8889e869a /src/systemtime.c
parentsystemtime: Fix includes and check for _POSIX_TIMERS (diff)
downloadredshift-ng-ba422bd78ec0d78611d0bced54c98d80da20a18d.tar.gz
redshift-ng-ba422bd78ec0d78611d0bced54c98d80da20a18d.tar.bz2
redshift-ng-ba422bd78ec0d78611d0bced54c98d80da20a18d.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--src/systemtime.c11
1 files changed, 11 insertions, 0 deletions
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
+}