veryl 0.20.1

A modern hardware description language
use std::time::Instant;

pub struct StopWatch {
    now: Instant,
}

impl Default for StopWatch {
    fn default() -> Self {
        Self {
            now: Instant::now(),
        }
    }
}

impl StopWatch {
    pub fn new() -> Self {
        Self::default()
    }

    pub fn lap(&mut self) -> u128 {
        let ret = self.now.elapsed().as_millis();
        self.now = Instant::now();
        ret
    }
}