diff --git a/libctru/source/os.c b/libctru/source/os.c index 29ad36a..402ea99 100644 --- a/libctru/source/os.c +++ b/libctru/source/os.c @@ -163,12 +163,3 @@ void osSetSpeedupEnable(bool enable) __ctru_speedup = enable; __ctru_speedup_config(); } - -int usleep(useconds_t useconds) -{ - - svcSleepThread(useconds * 1000ull); - - return 0; - -} diff --git a/libctru/source/system/syscalls.c b/libctru/source/system/syscalls.c index a0c2903..4d06f66 100644 --- a/libctru/source/system/syscalls.c +++ b/libctru/source/system/syscalls.c @@ -28,12 +28,20 @@ static struct _reent* __ctru_get_reent() return tv->reent; } +static int __libctru_nanosleep(const struct timespec *req, struct timespec *rem) +{ + svcSleepThread(req->tv_sec * 1000000000ull + req->tv_nsec); + return 0; +} + + void __system_initSyscalls(void) { // Register newlib syscalls __syscalls.exit = __ctru_exit; __syscalls.gettod_r = __libctru_gtod; __syscalls.getreent = __ctru_get_reent; + __syscalls.nanosleep = __libctru_nanosleep; // Register locking syscalls __syscalls.lock_init = LightLock_Init;