]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/unistd/sleep.c
Remove __wasilibc_unmodified_upstream markers from libc-bottom-half.
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / unistd / sleep.c
1 // Copyright (c) 2015 Nuxi, https://nuxi.nl/
2 //
3 // SPDX-License-Identifier: BSD-2-Clause
4
5 #include <time.h>
6 #include <unistd.h>
7
8 unsigned int sleep(unsigned int seconds) {
9 struct timespec ts = {.tv_sec = seconds, .tv_nsec = 0};
10 if (clock_nanosleep(CLOCK_REALTIME, 0, &ts, NULL) != 0)
11 return seconds;
12 return 0;
13 }