naia-shared 0.25.0

Common functionality shared between naia-server & naia-client crates
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::time::SystemTime;

/// Returns the current wall-clock time as seconds since the Unix epoch.
pub struct Timestamp;

impl Timestamp {
    /// Returns seconds since the Unix epoch as a `u64`.
    pub fn now() -> u64 {
        SystemTime::now()
            .duration_since(SystemTime::UNIX_EPOCH)
            .expect("timing error!")
            .as_secs()
    }
}