Skip to content

Commit 00d423a

Browse files
committed
feat(ptp): encode explicit IEEE 1588 timeProperties flags without false traceability
1 parent 2d7c0ae commit 00d423a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

  • include/ariec61850/time_sync

‎include/ariec61850/time_sync/ptp.hpp‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,24 @@ struct PtpFrame final {
131131
bool peer_delay_multicast{};
132132
};
133133

134+
// IEEE 1588-2008 flagField[1] (low octet of the wire flagField).
135+
// These are time-properties statements, distinct from the twoStep flag.
136+
// Unknown time provenance is represented by all flags false.
137+
struct PtpTimeProperties final {
138+
bool current_utc_offset_valid{};
139+
bool ptp_timescale{};
140+
bool time_traceable{};
141+
bool frequency_traceable{};
142+
143+
[[nodiscard]] constexpr std::uint16_t flags() const noexcept {
144+
return static_cast<std::uint16_t>(
145+
(current_utc_offset_valid ? 0x0004U : 0U) |
146+
(ptp_timescale ? 0x0008U : 0U) |
147+
(time_traceable ? 0x0010U : 0U) |
148+
(frequency_traceable ? 0x0020U : 0U));
149+
}
150+
};
151+
134152
struct PtpBuildOptions final {
135153
std::uint8_t transport_specific{};
136154
std::uint8_t domain_number{};
@@ -139,6 +157,7 @@ struct PtpBuildOptions final {
139157
std::int64_t correction_field{};
140158
std::int8_t log_message_interval{};
141159
bool two_step{true};
160+
PtpTimeProperties time_properties{};
142161
std::uint8_t priority1{128U};
143162
std::uint8_t priority2{128U};
144163
std::uint8_t clock_class{248U};

0 commit comments

Comments
 (0)