datex_core/utils/time.rs
1use crate::runtime::global_context::get_global_context;
2
3pub trait TimeTrait: Send + Sync {
4 /// Returns the current time in milliseconds since the Unix epoch.
5 fn now(&self) -> u64;
6}
7pub struct Time;
8impl Time {
9 pub fn now(&self) -> u64 {
10 let time = get_global_context().time;
11 let time = time.lock().unwrap();
12 time.now()
13 }
14}