|
|
These do not throw and instead return true/false.
|
bool | SetSecNSec (const int32_t sec, const int32_t nsec) |
| Set duration from seconds and nanoseconds.
|
|
bool | SetNSec (const int64_t nsec) |
| Set duration from nanoseconds.
|
|
bool | SetSec (const double sec) |
| Set duration from seconds.
|
|
|
int64_t | GetNSec () const |
| Get duration as nanoseconds.
|
|
double | GetSec (const int prec=9) const |
| Get duration as seconds.
|
|
std::chrono::milliseconds | GetChronoMilli () const |
| Get duration as std::chrono::milliseconds.
|
|
std::chrono::nanoseconds | GetChronoNano () const |
| Get duration as std::chrono::nanoseconds.
|
|
|
bool | IsZero () const |
| Check if duration is zero.
|
|
std::string | Stringify (const int prec=3) const |
| Stringify duration, for debugging.
|
|
void | Sleep () const |
| Sleep for the duration (if > 0)
|
|
|
These do not throw and instead return true/false.
|
bool | AddDur (const Duration &dur) |
| Add duration to duration.
|
|
bool | AddNSec (const int64_t nsec) |
| Add nanoseconds to duration.
|
|
bool | AddSec (const double sec) |
| Add seconds to duration.
|
|
bool | SubDur (const Duration &dur) |
| Substract duration from duration.
|
|
bool | SubNSec (const int64_t nsec) |
| Substract nanoseconds from duration.
|
|
bool | SubSec (const double sec) |
| Substract seconds from duration.
|
|
bool | Scale (const double sec) |
| Scale (multiply) duration.
|
|
|
- Note
- These throw std::runtime_error if the values are out of range.
|
Duration | operator+ (const Duration &rhs) const |
| Sum duration and duration.
|
|
Duration | operator+ (const int64_t nsec) const |
| Sum duration and nanoseconds.
|
|
Duration | operator+ (const double sec) const |
| Sum duration and seconds.
|
|
Duration & | operator+= (const Duration &rhs) |
| Add duration to duration.
|
|
Duration & | operator+= (const int64_t nsec) |
| Add nanoseconds to durationn.
|
|
Duration & | operator+= (const double sec) |
| Add seconds to duration.
|
|
Duration | operator- (const Duration &rhs) const |
| Subtract duration and duration.
|
|
Duration | operator- (const int64_t nsec) const |
| Subtract duration and nanoseconds.
|
|
Duration | operator- (const double sec) const |
| Subtract duration and seconds.
|
|
Duration & | operator-= (const Duration &rhs) |
| Subtract duration from duration.
|
|
Duration & | operator-= (const int64_t nsec) |
| Subtract nanoseconds from duration.
|
|
Duration & | operator-= (const double sec) |
| Subtract seconds from durationn.
|
|
Duration | operator- () const |
| Reverse sign.
|
|
Duration | operator* (double scale) const |
| Multiply (scale) duration.
|
|
Duration & | operator*= (double scale) |
| Multiply (scale) duration.
|
|
|
bool | operator== (const Duration &rhs) const |
| Equal.
|
|
bool | operator!= (const Duration &rhs) const |
| Not equal.
|
|
bool | operator> (const Duration &rhs) const |
| Greater than.
|
|
bool | operator< (const Duration &rhs) const |
| Smaller than.
|
|
bool | operator>= (const Duration &rhs) const |
| Greater or equal than.
|
|
bool | operator<= (const Duration &rhs) const |
| Smaller or equal than.
|
|
Time duration.
This is similar (and binary compatible) to ros::Duration and rpclpp::Duration. While some of the constructors and operators can throw, it also provides non-throwing methods to manipulate the duration.
Definition at line 153 of file time.hpp.