@@ -25,7 +25,7 @@ use core::sync::atomic::{AtomicBool, AtomicU64, Ordering};
25
25
use core:: time:: Duration ;
26
26
use core:: ops:: Add ;
27
27
28
- const NANOS_PER_SEC : u32 = 1_000_000_000 ;
28
+ const NANOS_PER_SEC : u64 = 1_000_000_000 ;
29
29
30
30
pub trait NativeTime : PartialOrd + Copy + Add < core:: time:: Duration , Output = Self > + ToOwned {
31
31
fn minimum ( ) -> Self ;
@@ -135,7 +135,7 @@ impl Ticks {
135
135
pub fn from_duration ( duration : Duration , freq : & Freq ) -> Self {
136
136
let freq = freq. as_u64 ( ) ;
137
137
let ticks_secs = duration. as_secs ( ) * freq;
138
- let ticks_nsecs = duration. subsec_nanos ( ) as u64 * freq / NANOS_PER_SEC as u64 ;
138
+ let ticks_nsecs = duration. subsec_nanos ( ) as u64 * freq / NANOS_PER_SEC ;
139
139
Ticks :: new ( ticks_secs + ticks_nsecs)
140
140
}
141
141
@@ -144,7 +144,7 @@ impl Ticks {
144
144
let ticks = self . 0 . load ( Ordering :: Relaxed ) ;
145
145
146
146
let time_secs = ticks / freq;
147
- let time_nsecs = ( ticks % freq * NANOS_PER_SEC as u64 ) / freq;
147
+ let time_nsecs = ( ticks % freq * NANOS_PER_SEC ) / freq;
148
148
let time_nsecs: u32 = time_nsecs. try_into ( ) . expect ( "must be smaller than 1sec" ) ;
149
149
150
150
Duration :: new ( time_secs, time_nsecs)
@@ -798,7 +798,7 @@ mod tests {
798
798
type Output = RandTime ;
799
799
800
800
fn add ( self , other : Duration ) -> Self :: Output {
801
- let t = self . 0 + other. as_secs ( ) * super :: NANOS_PER_SEC as u64 + other. subsec_nanos ( ) as u64 ;
801
+ let t = self . 0 + other. as_secs ( ) * super :: NANOS_PER_SEC + other. subsec_nanos ( ) as u64 ;
802
802
RandTime ( t)
803
803
}
804
804
}
@@ -829,7 +829,7 @@ mod tests {
829
829
type Output = SgxTime ;
830
830
831
831
fn add ( self , other : Duration ) -> Self :: Output {
832
- let t = self . 0 + other. as_secs ( ) * super :: NANOS_PER_SEC as u64 + other. subsec_nanos ( ) as u64 ;
832
+ let t = self . 0 + other. as_secs ( ) * super :: NANOS_PER_SEC + other. subsec_nanos ( ) as u64 ;
833
833
SgxTime ( t)
834
834
}
835
835
}
0 commit comments