ocelot_base/timestamp.rs
1/// Represents a monotonic timestamp in nanoseconds.
2#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
3pub struct Timestamp(u128);
4
5impl Timestamp {
6 /// Creates a new timestamp from a nanosecond value.
7 pub const fn new(nanos: u128) -> Self {
8 Self(nanos)
9 }
10
11 /// Returns the stored nanosecond value.
12 pub const fn as_nanos(self) -> u128 {
13 self.0
14 }
15}