about summary refs log tree commit diff
path: root/src/unistd/usleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/unistd/usleep.c')
-rw-r--r--src/unistd/usleep.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/unistd/usleep.c b/src/unistd/usleep.c
new file mode 100644
index 00000000..e3869017
--- /dev/null
+++ b/src/unistd/usleep.c
@@ -0,0 +1,11 @@
+#include <unistd.h>
+#include <time.h>
+
+int usleep(useconds_t useconds)
+{
+	struct timespec tv = {
+		.tv_sec = useconds/1000000,
+		.tv_nsec = (useconds%1000000)*1000
+	};
+	return nanosleep(&tv, &tv);
+}