btrfs_diskformat/core/time.rs
1use static_assertions::const_assert_eq;
2use zerocopy::little_endian::{I64 as I64LE, U32 as U32LE};
3use zerocopy_derive::*;
4
5/// The layout of timestamps on disk.
6#[derive(
7 Copy,
8 Clone,
9 Debug,
10 Hash,
11 PartialEq,
12 Eq,
13 PartialOrd,
14 IntoBytes,
15 FromBytes,
16 Unaligned,
17 KnownLayout,
18 Immutable,
19)]
20#[repr(C, packed)]
21pub struct Time {
22 /// The timestamp using Unix time convention.
23 pub timestamp: I64LE,
24
25 /// The number of nanoseconds past the beginning of the second denoted in [timestamp].
26 ///
27 /// [timestamp]: Time::timestamp
28 pub nanoseconds: U32LE,
29}
30const_assert_eq!(core::mem::size_of::<Time>(), 12);