]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/time/nanosleep.c
66cbbdfacec9830c71feb053372278701ba8be75
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / time / nanosleep.c
1 // Copyright (c) 2015 Nuxi, https://nuxi.nl/
2 //
3 // SPDX-License-Identifier: BSD-2-Clause
4
5 #include <errno.h>
6 #include <threads.h>
7 #include <time.h>
8 #include <_/cdefs.h>
9
10 int nanosleep(const struct timespec *rqtp, struct timespec *rem) {
11 int error = clock_nanosleep(CLOCK_REALTIME, 0, rqtp, rem);
12 if (error != 0) {
13 errno = error;
14 return -1;
15 }
16 return 0;
17 }
18
19 #if defined(_REENTRANT)
20 __strong_reference(nanosleep, thrd_sleep);
21 #endif