implement nanosleep

This commit is contained in:
Dave Murphy 2018-06-13 01:11:16 +01:00
parent 8b793729fc
commit 1b0380c2f9

View File

@ -111,9 +111,9 @@ int __libnx_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz) {
return 0; return 0;
} }
int usleep(useconds_t useconds)
{ int __libnx_nanosleep(const struct timespec *req, struct timespec *rem) {
svcSleepThread(useconds * 1000ull); svcSleepThread(req->tv_sec * 1000000000ull + req->tv_nsec);
return 0; return 0;
} }
@ -127,6 +127,8 @@ void newlibSetup(void) {
__syscalls.clock_getres = __libnx_clock_getres; __syscalls.clock_getres = __libnx_clock_getres;
__syscalls.clock_settime = __libnx_clock_settime; __syscalls.clock_settime = __libnx_clock_settime;
__syscalls.nanosleep = __libnx_nanosleep;
// Register locking syscalls // Register locking syscalls
__syscalls.lock_init = mutexInit; __syscalls.lock_init = mutexInit;