eryon_core/time/
mod.rs

1/*
2    Appellation: time <module>
3    Contrib: @FL03
4*/
5#[doc(inline)]
6pub use self::timestamp::Timestamp;
7
8pub mod timestamp;
9
10pub(crate) mod prelude {
11    pub use super::timestamp::Timestamp;
12    #[allow(unused_imports)]
13    pub use super::utils::*;
14}
15
16pub(crate) mod utils {
17    /// [systime] is a utilitarian function that returns the current system time in milliseconds.
18    #[cfg(feature = "std")]
19    #[inline]
20    pub fn systime() -> core::time::Duration {
21        std::time::SystemTime::now()
22            .duration_since(std::time::UNIX_EPOCH)
23            .unwrap()
24    }
25    /// [systime] is a utilitarian function that returns the current system time in milliseconds.
26    #[cfg(feature = "std")]
27    #[inline]
28    pub fn std_time() -> u128 {
29        std::time::SystemTime::now()
30            .duration_since(std::time::UNIX_EPOCH)
31            .unwrap()
32            .as_millis()
33    }
34}