Class Duration
Defined in File duration.hpp
Class Documentation
-
class Duration
Public Functions
-
Duration(int32_t seconds, uint32_t nanoseconds)
Duration constructor.
Initializes the time values for seconds and nanoseconds individually. Large values for nsecs are wrapped automatically with the remainder added to secs. Both inputs must be integers. Seconds can be negative.
- Parameters:
seconds – time in seconds
nanoseconds – time in nanoseconds
-
explicit Duration(std::chrono::nanoseconds nanoseconds)
Construct duration from the specified std::chrono::nanoseconds.
-
template<class Rep, class Period>
inline Duration(const std::chrono::duration<Rep, Period> &duration)
-
Duration(const builtin_interfaces::msg::Duration &duration_msg)
-
explicit Duration(const rcl_duration_t &duration)
Time constructor.
- Parameters:
duration – rcl_duration_t structure to copy.
-
virtual ~Duration() = default
-
operator builtin_interfaces::msg::Duration() const
-
rcl_duration_value_t nanoseconds() const
Get duration in nanosecods.
- Returns:
the duration in nanoseconds as a rcl_duration_value_t.
-
double seconds() const
Get duration in seconds.
Warning
Depending on sizeof(double) there could be significant precision loss. When an exact time is required use nanoseconds() instead.
- Returns:
the duration in seconds as a floating point number.
Public Static Functions
-
static Duration max()
Get the maximum representable value.
- Returns:
the maximum representable value
-
static Duration from_seconds(double seconds)
Create a duration object from a floating point number representing seconds.
-
Duration(int32_t seconds, uint32_t nanoseconds)