awaken-contract 0.4.0

Core types, traits, and state model for the Awaken AI agent runtime
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
/// Returns the current time in milliseconds since the UNIX epoch.
///
/// Uses `unwrap_or_default()` so the call never panics (returns `0` if the
/// system clock is before the epoch) and clamps the `u128` millis value to
/// [`u64::MAX`].
pub fn now_ms() -> u64 {
    std::time::SystemTime::now()
        .duration_since(std::time::UNIX_EPOCH)
        .unwrap_or_default()
        .as_millis()
        .min(u128::from(u64::MAX)) as u64
}