sparkles-core 0.1.8

Core crate for sparkles
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate std;

use std::time::UNIX_EPOCH;
use crate::TimestampProvider;

pub struct StdTimestamp;

// TODO: consider increasing TimestampType to avoid overflow
impl TimestampProvider for StdTimestamp {
    type TimestampType = u64;

    #[inline(always)]
    fn now() -> Self::TimestampType {
        UNIX_EPOCH.elapsed().unwrap().as_nanos() as u64
    }
}