@@ -66,7 +66,7 @@ impl Clock {
66
66
}
67
67
68
68
/// Compute `now + duration` relative to this clock.
69
- pub fn checked_add_since_now ( & self , duration : Duration ) -> Option < Time > {
69
+ pub fn get_time_relative ( & self , duration : Duration ) -> Option < Time > {
70
70
match self {
71
71
Self :: Host { .. } => Instant :: now ( ) . checked_add ( duration) . map ( Time :: Monotonic ) ,
72
72
Self :: Virtual { nanoseconds } =>
@@ -79,7 +79,7 @@ impl Clock {
79
79
80
80
/// Compute `start + duration` relative to this clock where `start` is the instant of time when
81
81
/// this clock was created.
82
- pub fn checked_add_since_start ( & self , duration : Duration ) -> Option < Time > {
82
+ pub fn get_time_absolute ( & self , duration : Duration ) -> Option < Time > {
83
83
match self {
84
84
Self :: Host { time_anchor } => time_anchor. checked_add ( duration) . map ( Time :: Monotonic ) ,
85
85
Self :: Virtual { .. } =>
@@ -301,10 +301,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
301
301
}
302
302
} ;
303
303
// If adding the duration overflows, let's just sleep for an hour. Waking up early is always acceptable.
304
- let timeout_time =
305
- this. machine . clock . checked_add_since_now ( duration) . unwrap_or_else ( || {
306
- this. machine . clock . checked_add_since_now ( Duration :: from_secs ( 3600 ) ) . unwrap ( )
307
- } ) ;
304
+ let timeout_time = this. machine . clock . get_time_relative ( duration) . unwrap_or_else ( || {
305
+ this. machine . clock . get_time_relative ( Duration :: from_secs ( 3600 ) ) . unwrap ( )
306
+ } ) ;
308
307
309
308
let active_thread = this. get_active_thread ( ) ;
310
309
this. block_thread ( active_thread) ;
@@ -330,7 +329,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
330
329
let timeout_ms = this. read_scalar ( timeout) ?. to_u32 ( ) ?;
331
330
332
331
let duration = Duration :: from_millis ( timeout_ms. into ( ) ) ;
333
- let timeout_time = this. machine . clock . checked_add_since_now ( duration) . unwrap ( ) ;
332
+ let timeout_time = this. machine . clock . get_time_relative ( duration) . unwrap ( ) ;
334
333
335
334
let active_thread = this. get_active_thread ( ) ;
336
335
this. block_thread ( active_thread) ;
0 commit comments