scsys_time/utils/impl_std.rs
1/*
2 Appellation: impl_std <module>
3 Created At: 2025.09.08:17:30:03
4 Contrib: @FL03
5*/
6#[allow(unused_imports)]
7use core::time::Duration;
8
9/// the [`systime`] function returns the current system timestamp as a [`Duration`] allowing
10/// users to convert the object into their desired units.
11#[inline]
12pub fn systime() -> Duration {
13 std::time::SystemTime::now()
14 .duration_since(std::time::UNIX_EPOCH)
15 .unwrap()
16}
17/// the [`std_time`] function returns the current system time in milliseconds as an [`u128`].
18#[inline]
19pub fn std_time() -> u128 {
20 systime().as_millis()
21}