nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
Loading...
Searching...
No Matches
Functions
nros::detail Namespace Reference

Functions

constexpr Duration qos_window_duration (uint32_t ms)
 
constexpr uint32_t qos_window_ms (const Duration &d)
 

Function Documentation

◆ qos_window_duration()

constexpr Duration nros::detail::qos_window_duration ( uint32_t  ms)
constexpr

The inverse: the C ABI's milliseconds as a Duration. Exact, and exact in both directions — qos_window_ms(qos_window_duration(ms)) == ms.

◆ qos_window_ms()

constexpr uint32_t nros::detail::qos_window_ms ( const Duration &  d)
constexpr

Milliseconds one QoS window is worth, at the Duration → C-ABI boundary.

The C ABI is uint32_t milliseconds (nros_cpp_qos_t.deadline_ms and siblings) and 0 there means INFINITE, so truncation is not a rounding question — a 500 µs deadline truncated to 0 would silently mean "no deadline at all". So:

  • <= 00. A non-positive window is the "unset" spelling (Duration() / Duration::zero()), and 0 is the ABI's infinity.
  • otherwise ROUND UP to the next whole millisecond. A sub-millisecond window becomes 1 ms rather than infinity, and rounding up is the lenient direction for all three policies (a longer deadline, lifespan or lease never turns a working profile into a violated one).
  • above UINT32_MAX ms (~49.7 days) → UINT32_MAX, saturating rather than wrapping into a short window.