acme_chains/core/utils.rs
1/*
2 Appellation: utils
3 Context:
4 Creator: FL03 <jo3mccain@icloud.com>
5 Description:
6 ... Summary ...
7*/
8pub use dates::*;
9
10mod dates {
11 use crate::BTStamp;
12
13 #[derive(Clone, Debug, Hash, serde::Deserialize, PartialEq, serde::Serialize)]
14 pub struct BlockStamp;
15
16 impl BlockStamp {
17 pub fn local() -> BTStamp {
18 block_ts_local()
19 }
20 pub fn utc() -> BTStamp {
21 block_ts_utc()
22 }
23 }
24
25 pub fn block_ts_local() -> BTStamp {
26 chrono::Local::now().timestamp()
27 }
28
29 pub fn block_ts_utc() -> BTStamp {
30 chrono::Utc::now().timestamp()
31 }
32}