lightning_signer/signer/
mod.rs1pub mod my_keys_manager;
3#[macro_use]
5pub mod multi_signer;
6pub mod derive;
8
9#[cfg(feature = "std")]
10use alloc::sync::Arc;
11
12use crate::prelude::SendSync;
13
14pub trait StartingTimeFactory: SendSync {
16 fn starting_time(&self) -> (u64, u32);
21}
22
23#[cfg(feature = "std")]
25pub struct ClockStartingTimeFactory {}
26
27#[cfg(feature = "std")]
28impl SendSync for ClockStartingTimeFactory {}
29
30#[cfg(feature = "std")]
31impl StartingTimeFactory for ClockStartingTimeFactory {
32 fn starting_time(&self) -> (u64, u32) {
35 use std::time::SystemTime;
36 let now =
37 SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).expect("is this the future?");
38 (now.as_secs(), now.subsec_nanos())
39 }
40}
41
42#[cfg(feature = "std")]
43impl ClockStartingTimeFactory {
44 pub fn new() -> Arc<dyn StartingTimeFactory> {
46 Arc::new(ClockStartingTimeFactory {})
47 }
48}