shinyframework_common 0.1.2

Shiny Common
Documentation
use chrono::{DateTime, Utc};

pub trait Clock: Send + Sync {
    fn now(&self) -> DateTime<Utc>;
}

pub struct StaticClock(pub DateTime<Utc>);

impl Clock for StaticClock {
    fn now(&self) -> DateTime<Utc> {
        self.0
    }
}

pub struct SystemClock;

impl Clock for SystemClock {
    fn now(&self) -> DateTime<Utc> {
        Utc::now()
    }
}