pub mod my_keys_manager;
#[macro_use]
pub mod multi_signer;
pub mod derive;
#[cfg(feature = "std")]
use alloc::sync::Arc;
use crate::prelude::SendSync;
pub trait StartingTimeFactory: SendSync {
fn starting_time(&self) -> (u64, u32);
}
#[cfg(feature = "std")]
pub struct ClockStartingTimeFactory {}
#[cfg(feature = "std")]
impl SendSync for ClockStartingTimeFactory {}
#[cfg(feature = "std")]
impl StartingTimeFactory for ClockStartingTimeFactory {
fn starting_time(&self) -> (u64, u32) {
use std::time::SystemTime;
let now =
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).expect("is this the future?");
(now.as_secs(), now.subsec_nanos())
}
}
#[cfg(feature = "std")]
impl ClockStartingTimeFactory {
pub fn new() -> Arc<dyn StartingTimeFactory> {
Arc::new(ClockStartingTimeFactory {})
}
}