Skip to content
Myr

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 file

Take it

The walk stopped after 200 commits: lines older than 69c91f5 point at it.

Revert to prev. sentenceDavid Peterbefore adoption69c91f5

lines 1–20why, one step back
1use 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}