diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a37bcc3..be6078e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,6 +17,7 @@ set(SOURCES
ir.h
nunchuk.h
os.h
+ util.c
wiiuse_internal.h
wiiboard.h)
set(API
diff --git a/src/util.c b/src/util.c
new file mode 100644
index 0000000..8198e4c
--- /dev/null
+++ b/src/util.c
@@ -0,0 +1,49 @@
+/*
+ * wiiuse
+ *
+ * Copyright 2011 Iowa State University Virtual Reality Applications Center
+ *
+ * This file is part of wiiuse.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * $Header$
+ *
+ */
+
+/**
+ * @file
+ * @brief Provides platform-specific utility functions.
+ */
+
+
+#include "wiiuse_internal.h"
+
+#ifdef WIIUSE_WIN32
+
+#include
+
+void wiiuse_millisleep(int durationMilliseconds) {
+ Sleep(durationMilliseconds);
+}
+
+#else /* not win32 - assuming posix */
+
+#include // for usleep
+
+void wiiuse_millisleep(int durationMilliseconds) {
+ usleep(durationMilliseconds * 1000);
+}
+
+#endif /* ifdef WIIUSE_WIN32 */
diff --git a/src/wiiuse_internal.h b/src/wiiuse_internal.h
index 7f674ee..142de9a 100644
--- a/src/wiiuse_internal.h
+++ b/src/wiiuse_internal.h
@@ -248,6 +248,15 @@ extern "C" {
#endif
/* not part of the api */
+
+/** @brief Cross-platform call to sleep for at least the specified number
+ * of milliseconds.
+ *
+ * Use instead of Sleep(), usleep(), or similar functions.
+ * Defined in util.c
+ */
+void wiiuse_millisleep(int durationMilliseconds);
+
int wiiuse_set_report_type(struct wiimote_t* wm);
void wiiuse_send_next_pending_read_request(struct wiimote_t* wm);
int wiiuse_send(struct wiimote_t* wm, byte report_type, byte* msg, int len);