@@ -106,7 +106,7 @@ impl Hierarchy {
106
106
LongTerm => self . long_term . cancel ( timer_reference_number) ,
107
107
} ;
108
108
109
- arc_timer. monotonic_time_milliseconds - monotonic :: time_in_milliseconds ( )
109
+ arc_timer. milliseconds_remaining ( )
110
110
} )
111
111
}
112
112
@@ -132,18 +132,7 @@ impl Hierarchy {
132
132
self . timer_by_reference_number
133
133
. get ( & timer_reference_number)
134
134
. and_then ( |weak_timer| weak_timer. upgrade ( ) )
135
- . map ( |rc_timer| {
136
- // The timer may be read when it is past its timeout, but it has not been timed-out
137
- // by the scheduler. Without this, an underflow would occur.
138
- // `0` is returned on underflow because that is what Erlang returns.
139
- match rc_timer
140
- . monotonic_time_milliseconds
141
- . checked_sub ( monotonic:: time_in_milliseconds ( ) )
142
- {
143
- Some ( difference) => difference,
144
- None => 0 ,
145
- }
146
- } )
135
+ . map ( |rc_timer| rc_timer. milliseconds_remaining ( ) )
147
136
}
148
137
149
138
fn start (
@@ -388,6 +377,19 @@ struct Timer {
388
377
}
389
378
390
379
impl Timer {
380
+ fn milliseconds_remaining ( & self ) -> Milliseconds {
381
+ // The timer may be read when it is past its timeout, but it has not been timed-out
382
+ // by the scheduler. Without this, an underflow would occur.
383
+ // `0` is returned on underflow because that is what Erlang returns.
384
+ match self
385
+ . monotonic_time_milliseconds
386
+ . checked_sub ( monotonic:: time_in_milliseconds ( ) )
387
+ {
388
+ Some ( difference) => difference,
389
+ None => 0 ,
390
+ }
391
+ }
392
+
391
393
fn timeout ( self ) -> Result < ( ) , Alloc > {
392
394
let option_destination_arc_process = match & self . destination {
393
395
Destination :: Name ( ref name) => registry:: atom_to_process ( name) ,
0 commit comments