File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -149,9 +149,11 @@ mod inner {
149149 impl Instant {
150150 pub fn now ( ) -> Instant {
151151 extern "C" {
152- fn mach_absolute_time ( ) -> u64 ;
152+ //fn mach_absolute_time() -> u64;
153+ fn clock_gettime_nsec_np ( clock_type : i64 ) -> u64 ;
153154 }
154- Instant { t : unsafe { mach_absolute_time ( ) } }
155+ Instant { t : unsafe { clock_gettime_nsec_np ( 4 ) } }
156+ //Instant { t: unsafe { mach_absolute_time() } }
155157 }
156158
157159 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 {
1212 } } ;
1313}
1414
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+
1525#[ test]
1626fn instant_monotonic ( ) {
1727 let a = Instant :: now ( ) ;
You can’t perform that action at this time.
0 commit comments