use instant::SystemTime;

use serde_derive::{Serialize, Deserialize};

#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, Debug)]
#[serde(transparent)]
pub struct MsSinceEpoch(pub i64);

impl MsSinceEpoch {
    fn now() -> Self {
        MsSinceEpoch(SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis() as i64)
    }
}

pub fn now() -> MsSinceEpoch {
    MsSinceEpoch::now()
}