#[cfg(feature = "std")]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "c_compatible", repr(C))]
pub struct NativeTime {
pub time: std::time::Instant,
}
#[cfg(feature = "std")]
impl NativeTime {
#[must_use]
pub fn new() -> Self {
Self {
time: std::time::Instant::now(),
}
}
}
#[cfg(feature = "std")]
impl Default for NativeTime {
fn default() -> Self {
Self::new()
}
}
#[cfg(feature = "std")]
impl super::Time for NativeTime {
fn get_elapsed_time(&self) -> f64 {
self.time.elapsed().as_secs_f64()
}
}