powerlink_rs/common.rs
1use crate::types::{UNSIGNED16, UNSIGNED32};
2
3/// Represents a 64-bit NetTime value as defined by IEEE 1588.
4/// (EPSG DS 301, Section 6.1.6.7)
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub struct NetTime {
7 pub seconds: UNSIGNED32,
8 pub nanoseconds: UNSIGNED32,
9}
10
11/// Represents a 64-bit RelativeTime value used in the SoC frame.
12/// (EPSG DS 301, Section 4.6.1.1.2)
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub struct RelativeTime {
15 pub seconds: UNSIGNED32,
16 pub nanoseconds: UNSIGNED32,
17}
18
19/// Represents the TIME_OF_DAY data type.
20/// (EPSG DS 301, Section 6.1.6.4)
21#[derive(Debug, Clone, Copy, PartialEq, Eq)]
22pub struct TimeOfDay {
23 /// Milliseconds after midnight.
24 pub ms: UNSIGNED32,
25 /// Days since January 1, 1984.
26 pub days: UNSIGNED16,
27}
28
29/// Represents the TIME_DIFFERENCE data type.
30/// (EPSG DS 301, Section 6.1.6.5)
31#[derive(Debug, Clone, Copy, PartialEq, Eq)]
32pub struct TimeDifference {
33 /// Milliseconds portion of the difference.
34 pub ms: UNSIGNED32,
35 /// Days portion of the difference.
36 pub days: UNSIGNED16,
37}