diff --git a/tor-circmgr/src/build.rs b/tor-circmgr/src/build.rs index f8b36dbb8..338e364a3 100644 --- a/tor-circmgr/src/build.rs +++ b/tor-circmgr/src/build.rs @@ -74,7 +74,7 @@ impl CircuitBuilder { OwnedPath::ChannelOnly(_) => { let circ = pending_circ.create_firsthop_fast(&mut rng, ¶ms).await?; self.timeouts - .note_hop_completed(0, Instant::now() - start_time, true); + .note_hop_completed(0, self.runtime.now() - start_time, true); n_hops_built.fetch_add(1, Ordering::SeqCst); Ok(circ) } @@ -85,7 +85,7 @@ impl CircuitBuilder { .create_firsthop_ntor(&mut rng, &p[0], ¶ms) .await?; self.timeouts - .note_hop_completed(0, Instant::now() - start_time, n_hops == 0); + .note_hop_completed(0, self.runtime.now() - start_time, n_hops == 0); n_hops_built.fetch_add(1, Ordering::SeqCst); let mut hop_num = 1; for relay in p[1..].iter() { @@ -93,7 +93,7 @@ impl CircuitBuilder { n_hops_built.fetch_add(1, Ordering::SeqCst); self.timeouts.note_hop_completed( hop_num, - Instant::now() - start_time, + self.runtime.now() - start_time, hop_num == n_hops, ); hop_num += 1; @@ -112,7 +112,7 @@ impl CircuitBuilder { ) -> Result> { let action = Action::BuildCircuit { length: path.len() }; let (timeout, abandon_timeout) = self.timeouts.timeouts(&action); - let start_time = Instant::now(); + let start_time = self.runtime.now(); // TODO: This is probably not the best way for build_notimeout to // tell us how many hops it managed to build, but at least it is @@ -130,7 +130,7 @@ impl CircuitBuilder { Err(Error::CircTimeout) => { let n_built = hops_built.load(Ordering::SeqCst); self.timeouts - .note_circ_timeout(n_built as u8, Instant::now() - start_time); + .note_circ_timeout(n_built as u8, self.runtime.now() - start_time); Err(Error::CircTimeout) } Err(e) => Err(e),