File tree 2 files changed +14
-2
lines changed 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -149,9 +149,11 @@ mod inner {
149
149
impl Instant {
150
150
pub fn now ( ) -> Instant {
151
151
extern "C" {
152
- fn mach_absolute_time ( ) -> u64 ;
152
+ //fn mach_absolute_time() -> u64;
153
+ fn clock_gettime_nsec_np ( clock_type : i64 ) -> u64 ;
153
154
}
154
- Instant { t : unsafe { mach_absolute_time ( ) } }
155
+ Instant { t : unsafe { clock_gettime_nsec_np ( 4 ) } }
156
+ //Instant { t: unsafe { mach_absolute_time() } }
155
157
}
156
158
157
159
pub fn checked_sub_instant ( & self , other : & Instant ) -> Option < Duration > {
Original file line number Diff line number Diff line change @@ -12,6 +12,16 @@ macro_rules! assert_almost_eq {
12
12
} } ;
13
13
}
14
14
15
+ #[ test]
16
+ #[ cfg( all( target_arch = "aarch64" , target_os = "macos" ) ) ]
17
+ fn wtf ( ) {
18
+ let t0 = Instant :: now ( ) ;
19
+ let t1 = t0 + Duration :: from_nanos ( 50 ) ;
20
+ let d = t1 - t0;
21
+ dbg ! ( t0, t1, d) ;
22
+ assert_eq ! ( t0 + d, t1) ;
23
+ }
24
+
15
25
#[ test]
16
26
fn instant_monotonic ( ) {
17
27
let a = Instant :: now ( ) ;
You can’t perform that action at this time.
0 commit comments