use borsh::{BorshDeserialize, BorshSerialize};
use serde::{Deserialize, Serialize};
use std::hash::Hash;
use time::OffsetDateTime;
/// A struct representing a timestamp.
#[derive(
Debug,
Clone,
Eq,
PartialEq,
PartialOrd,
Ord,
BorshSerialize,
BorshDeserialize,
Hash,
Serialize,
Deserialize,
)]
pub struct TimeStamp(pub u64);
impl TimeStamp {
/// Returns a new `TimeStamp` representing the current time.
pub fn now() -> Self {
Self(OffsetDateTime::now_utc().unix_timestamp_nanos() as u64)
}
}