wall_clock_timer.rs
This file
Path
src/timer/wall_clock_timer.rs
20 lines · 413 bytes · Rust
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 251a697 point at it.
Bump libc from 0.2.121 to 0.2.125dependabot[bot]before adoption251a697
lines 1–20why, one step back1use std::time::Instant;23use crate::util::units::Second;45pub struct WallClockTimer {6 start: Instant,7}89impl WallClockTimer {10 pub fn start() -> WallClockTimer {11 WallClockTimer {12 start: Instant::now(),13 }14 }1516 pub fn stop(&self) -> Second {17 let duration = self.start.elapsed();18 duration.as_secs() as f64 + f64::from(duration.subsec_nanos()) * 1e-919 }20}