wall_clock_timer.rs
This file
Path
src/timer/wall_clock_timer.rs
22 lines · 476 bytes · Rust
Last changed by
Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
History of this fileTake it
The walk stopped after 200 commits: lines older than 0f91d0c point at it.
Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 1–2why, one step back1use std::time::Instant;2Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 3why, one step back3use crate::quantity::{nanosecond, second, Time};Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 4–15why, one step back45pub struct WallClockTimer {6 start: Instant,7}89impl WallClockTimer {10 pub fn start() -> WallClockTimer {11 WallClockTimer {12 start: Instant::now(),13 }14 }15Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 16why, one step back16 pub fn stop(&self) -> Time {Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 17why, one step back17 let duration = self.start.elapsed();Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
lines 18–20why, one step back1819 Time::new::<second>(duration.as_secs() as f64)20 + Time::new::<nanosecond>(duration.subsec_nanos() as f64)Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 21–22why, one step back21 }22}