summaryrefslogtreecommitdiff
path: root/src/unistd/sleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/unistd/sleep.c')
-rw-r--r--src/unistd/sleep.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/unistd/sleep.c b/src/unistd/sleep.c
new file mode 100644
index 00000000..d6450941
--- /dev/null
+++ b/src/unistd/sleep.c
@@ -0,0 +1,10 @@
+#include <unistd.h>
+#include <time.h>
+
+unsigned sleep(unsigned seconds)
+{
+ struct timespec tv = { .tv_sec = seconds, .tv_nsec = 0 };
+ if (nanosleep(&tv, &tv))
+ return tv.tv_sec;
+ return 0;
+}