//! Interfaces for time-providing devices

use yggdrasil_abi::{error::Error, time::SystemTime};

use crate::device::Device;

/// Interface for precise timing devices
pub trait MonotonicTimestampProviderDevice: Device {
    /// Provides a timestamp value of the timer. The value:
    ///
    /// * Represents monotonically increasing clock time since some arbitrary point in the past.
    /// * Can be used for delays and measuring time passed between two measurements.
    ///
    /// * Is not an accurate wall-clock time or real-world time.
    /// * Cannot be used for date/time managament purposes.
    fn monotonic_timestamp(&self) -> Result<SystemTime, Error>;
}

/// Interface for real-world time-telling devices
pub trait RealTimeProviderDevice: Device {
    /// Provides a real-time clock value of the timer. The value:
    ///
    /// * Represents a real-world time since TODO TODO TODO.
    /// * Can be used for rough measurements of duration passed between two points in time.
    /// * Can be used for delays, but precision is not guaranteed.
    /// * Can be used for date/time management.
    fn real_timestamp(&self) -> Result<SystemTime, Error>;
}
