File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -42,21 +42,19 @@ mod mock {
4242mod mock {
4343 use smoltcp:: time:: { Duration , Instant } ;
4444 use std:: sync:: Arc ;
45- use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
45+ use std:: sync:: atomic:: { AtomicU64 , Ordering } ;
4646
47- // should be AtomicU64 but that's unstable
4847 #[ derive( Debug , Clone ) ]
4948 #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
50- pub struct Clock ( Arc < AtomicUsize > ) ;
49+ pub struct Clock ( Arc < AtomicU64 > ) ;
5150
5251 impl Clock {
5352 pub fn new ( ) -> Clock {
54- Clock ( Arc :: new ( AtomicUsize :: new ( 0 ) ) )
53+ Clock ( Arc :: new ( AtomicU64 :: new ( 0 ) ) )
5554 }
5655
5756 pub fn advance ( & self , duration : Duration ) {
58- self . 0
59- . fetch_add ( duration. total_millis ( ) as usize , Ordering :: SeqCst ) ;
57+ self . 0 . fetch_add ( duration. total_millis ( ) , Ordering :: SeqCst ) ;
6058 }
6159
6260 pub fn elapsed ( & self ) -> Instant {
Original file line number Diff line number Diff line change @@ -13,22 +13,20 @@ mod utils;
1313
1414mod mock {
1515 use smoltcp:: time:: { Duration , Instant } ;
16- use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
1716 use std:: sync:: Arc ;
17+ use std:: sync:: atomic:: { AtomicU64 , Ordering } ;
1818
19- // should be AtomicU64 but that's unstable
2019 #[ derive( Debug , Clone ) ]
2120 #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
22- pub struct Clock ( Arc < AtomicUsize > ) ;
21+ pub struct Clock ( Arc < AtomicU64 > ) ;
2322
2423 impl Clock {
2524 pub fn new ( ) -> Clock {
26- Clock ( Arc :: new ( AtomicUsize :: new ( 0 ) ) )
25+ Clock ( Arc :: new ( AtomicU64 :: new ( 0 ) ) )
2726 }
2827
2928 pub fn advance ( & self , duration : Duration ) {
30- self . 0
31- . fetch_add ( duration. total_millis ( ) as usize , Ordering :: SeqCst ) ;
29+ self . 0 . fetch_add ( duration. total_millis ( ) , Ordering :: SeqCst ) ;
3230 }
3331
3432 pub fn elapsed ( & self ) -> Instant {
You can’t perform that action at this time.
0 commit comments