logicaffeine_system/
temporal.rs1use std::fmt::{self, Display};
6
7pub use logicaffeine_data::temporal::*;
8
9#[cfg(not(target_arch = "wasm32"))]
11pub fn current_moment() -> LogosMoment {
12 use std::time::{SystemTime, UNIX_EPOCH};
13 let duration = SystemTime::now()
14 .duration_since(UNIX_EPOCH)
15 .unwrap_or_default();
16 LogosMoment(duration.as_nanos() as i64)
17}
18
19impl crate::io::Showable for LogosDate {
20 fn format_show(&self, f: &mut fmt::Formatter) -> fmt::Result {
21 Display::fmt(self, f)
22 }
23}
24
25impl crate::io::Showable for LogosMoment {
26 fn format_show(&self, f: &mut fmt::Formatter) -> fmt::Result {
27 Display::fmt(self, f)
28 }
29}
30
31impl crate::io::Showable for LogosSpan {
32 fn format_show(&self, f: &mut fmt::Formatter) -> fmt::Result {
33 Display::fmt(self, f)
34 }
35}
36
37impl crate::io::Showable for LogosTime {
38 fn format_show(&self, f: &mut fmt::Formatter) -> fmt::Result {
39 Display::fmt(self, f)
40 }
41}