Flat directory/module structure

This commit is contained in:
David Peter authored and David Peter committed 2021-08-24 22:44:08 +02:00
1 parent d31936ec28
commit 30c381fe2a
27 files changed
+70 -71

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
use std::process::Child;
use std::time::Instant;
use crate::timer::{TimerStart, TimerStop};
use crate::units::Second;
pub struct WallClockTimer {
start: Instant,
}
impl TimerStart for WallClockTimer {
fn start() -> WallClockTimer {
WallClockTimer {
start: Instant::now(),
}
}
fn start_for_process(_: &Child) -> Self {
Self::start()
}
}
impl TimerStop for WallClockTimer {
type Result = Second;
fn stop(&self) -> Second {
let duration = self.start.elapsed();
duration.as_secs() as f64 + f64::from(duration.subsec_nanos()) * 1e-9
}
}