From 218bb29cf337e9db010369155bbd99602aec6054 Mon Sep 17 00:00:00 2001 From: Yuhao Zhou Date: Sun, 21 Apr 2019 14:30:02 +0800 Subject: [PATCH] Fix TimeSpec type. --- kernel/src/syscall/time.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/src/syscall/time.rs b/kernel/src/syscall/time.rs index 2ae76d4..edea0f6 100644 --- a/kernel/src/syscall/time.rs +++ b/kernel/src/syscall/time.rs @@ -53,20 +53,20 @@ impl TimeVal { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct TimeSpec { - sec: u64, - nsec: u64, + sec: usize, + nsec: usize, } impl TimeSpec { pub fn to_duration(&self) -> Duration { - Duration::new(self.sec, self.nsec as u32) + Duration::new(self.sec as u64, self.nsec as u32) } pub fn get_epoch() -> Self { let usec = get_epoch_usec(); TimeSpec { - sec: usec / USEC_PER_SEC, - nsec: usec % USEC_PER_SEC * NSEC_PER_USEC, + sec: (usec / USEC_PER_SEC) as usize, + nsec: (usec % USEC_PER_SEC * NSEC_PER_USEC) as usize, } } }