@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
5
5
use std:: sync:: atomic:: { AtomicBool , AtomicUsize } ;
6
6
use std:: sync:: { atomic, Arc } ;
7
7
use std:: thread:: { sleep, JoinHandle } ;
8
- use std:: time:: { Duration , SystemTime } ;
8
+ use std:: time:: { Duration , Instant } ;
9
9
use std:: { fs, thread} ;
10
10
11
11
use crossbeam_channel:: Sender ;
@@ -529,10 +529,10 @@ pub fn prepare_thread_handler_common(
529
529
let atomic_counter = atomic_counter. clone ( ) ;
530
530
thread:: spawn ( move || {
531
531
// Use earlier time, to send immediately first message
532
- let mut time_since_last_send = SystemTime :: now ( ) - Duration :: from_secs ( 10u64 ) ;
532
+ let mut time_since_last_send = Instant :: now ( ) . checked_sub ( Duration :: from_secs ( 10u64 ) ) . unwrap ( ) ;
533
533
534
534
loop {
535
- if time_since_last_send. elapsed ( ) . expect ( "Cannot count time backwards" ) . as_millis ( ) > SEND_PROGRESS_DATA_TIME_BETWEEN as u128 {
535
+ if time_since_last_send. elapsed ( ) . as_millis ( ) > SEND_PROGRESS_DATA_TIME_BETWEEN as u128 {
536
536
let progress_data = ProgressData {
537
537
sstage,
538
538
checking_method,
@@ -546,7 +546,7 @@ pub fn prepare_thread_handler_common(
546
546
progress_data. validate ( ) ;
547
547
548
548
progress_send. send ( progress_data) . expect ( "Cannot send progress data" ) ;
549
- time_since_last_send = SystemTime :: now ( ) ;
549
+ time_since_last_send = Instant :: now ( ) ;
550
550
}
551
551
if !progress_thread_run. load ( atomic:: Ordering :: Relaxed ) {
552
552
break ;
0 commit comments