use log::debug;

use crate::Jiffies;

#[derive(Default)]
pub(super) struct Clock {
    now: Jiffies,
}

impl Clock {
    pub(super) fn fast_forward(&mut self, future: Jiffies) {
        debug_assert!(self.now <= future, "Future < Present");
        if self.now < future {
            debug!("Global time changed: {} -> {future}", self.now);
            self.now = future;
        }
    }

    pub(crate) fn now(&self) -> Jiffies {
        self.now
    }
}
