1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
use {
    byteorder::LE,
    static_assertions::const_assert_eq,
    zerocopy::{AsBytes, FromBytes, Unaligned, I64, U32},
};

/// The layout of timestamps on disk.
#[derive(Copy, Clone, Debug, AsBytes, FromBytes, Unaligned)]
#[repr(C, packed)]
pub struct Time {
    /// The timestamp using Unix time convention.
    pub timestamp: I64<LE>,

    /// The number of nanoseconds past the beginning of the second denoted in [timestamp].
    ///
    /// [timestamp]: Time::timestamp
    pub nanoseconds: U32<LE>,
}
const_assert_eq!(core::mem::size_of::<Time>(), 12);