Reconstruct utime-like syscalls and fix filetime implementations

This commit is contained in:
Fabing Li
2024-06-13 14:53:09 +08:00
committed by Tate, Hongliang Tian
parent 3de8a9330a
commit 5edc110f9d
21 changed files with 328 additions and 88 deletions

View File

@ -43,6 +43,15 @@ impl From<Duration> for timespec_t {
}
}
impl From<timeval_t> for timespec_t {
fn from(timeval: timeval_t) -> timespec_t {
let sec = timeval.sec;
let nsec = timeval.usec * 1000;
debug_assert!(sec >= 0); // nsec >= 0 always holds
timespec_t { sec, nsec }
}
}
impl From<timespec_t> for Duration {
fn from(timespec: timespec_t) -> Self {
Duration::new(timespec.sec as u64, timespec.nsec as u32)