diff --git a/src/header/time/mod.rs b/src/header/time/mod.rs index 1a432bf3..db30e0d7 100644 --- a/src/header/time/mod.rs +++ b/src/header/time/mod.rs @@ -7,7 +7,7 @@ use crate::{ error::{Errno, ResultExt}, header::{ bits_timespec::timespec, - errno::{EFAULT, ENOMEM, EOVERFLOW, ETIMEDOUT}, + errno::{EFAULT, EINVAL, ENOMEM, EOVERFLOW, ETIMEDOUT}, signal::sigevent, stdlib::getenv, unistd::readlink, @@ -280,7 +280,19 @@ pub extern "C" fn clock_nanosleep( rqtp: *const timespec, rmtp: *mut timespec, ) -> c_int { - unimplemented!(); + match clock_id { + CLOCK_REALTIME | CLOCK_MONOTONIC => { + if flags == TIMER_ABSTIME { + return EINVAL; + } + match unsafe { Sys::nanosleep(rqtp, rmtp) } { + Ok(()) => 0, + Err(Errno(ETIMEDOUT)) => ETIMEDOUT, + Err(Errno(e)) => e, + } + } + _ => EINVAL, + } } /// See .