1
2
3
4
5
6
7
8
9
10
11
//! Utitility functions

/// Returns monotonically increasing time in seconds.
#[inline]
pub fn sec_since_start() -> f64 {
    use once_cell::sync::Lazy;
    use web_time::Instant;

    static START_INSTANT: Lazy<Instant> = Lazy::new(Instant::now);
    START_INSTANT.elapsed().as_nanos() as f64 / 1e9
}