wall_clock_timer.rs
This file
Path
src/timer/wall_clock_timer.rs
22 lines · 468 bytes · Rust
Last changed by
Move quantity moduleDavid Peterbefore adoptionbe66a66
History of this fileTake it
The walk stopped after 200 commits: lines older than a719153 point at it.
Update CHANGELOGDavid Peterbefore adoptiona719153
lines 1–2why, one step back1use std::time::Instant;2Move quantity moduleDavid Peterbefore adoptionbe66a66
line 3why, one step back3use crate::quantity::{Time, TimeQuantity};Update CHANGELOGDavid Peterbefore adoptiona719153
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 {Update CHANGELOGDavid Peterbefore adoptiona719153
line 17why, one step back17 let duration = self.start.elapsed();Use uomDavid Peterbefore adoption641451a
lines 18–20why, one step back1819 Time::from_seconds(duration.as_secs() as f64)20 + Time::from_nanoseconds(duration.subsec_nanos() as f64)Update CHANGELOGDavid Peterbefore adoptiona719153
lines 21–22why, one step back21 }22}