1 #ifndef PROTON_DURATION_HPP
2 #define PROTON_DURATION_HPP
25 #include "./internal/export.hpp"
26 #include "./internal/comparable.hpp"
29 #include <proton/type_compat.h>
39 class duration :
private internal::comparable<duration> {
69 inline bool operator==(duration x, duration y) {
return x.milliseconds() == y.milliseconds(); }
71 inline duration operator+(duration x, duration y) {
return duration(x.milliseconds() + y.milliseconds()); }
72 inline duration operator-(duration x, duration y) {
return duration(x.milliseconds() - y.milliseconds()); }
73 inline duration operator*(duration d, uint64_t n) {
return duration(d.milliseconds()*n); }
74 inline duration operator*(uint64_t n, duration d) {
return d * n; }
75 inline duration operator/(duration d, uint64_t n) {
return duration(d.milliseconds() / n); }
A span of time in milliseconds.
Definition: duration.hpp:39
duration & operator=(numeric_type ms)
Assign a value in milliseconds.
Definition: duration.hpp:48
static const duration MINUTE
One minute.
Definition: duration.hpp:57
int64_t numeric_type
A numeric type holding a value in milliseconds.
Definition: duration.hpp:42
duration(numeric_type ms=0)
Construct from a value in milliseconds.
Definition: duration.hpp:45
static const duration IMMEDIATE
Don't wait at all.
Definition: duration.hpp:54
static const duration FOREVER
Wait forever.
Definition: duration.hpp:53
static const duration SECOND
One second.
Definition: duration.hpp:55
static const duration MILLISECOND
One millisecond.
Definition: duration.hpp:56
numeric_type milliseconds() const
Get the value in milliseconds.
Definition: duration.hpp:51
The main Proton namespace.
Definition: annotation_key.hpp:33
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
Forward declarations for Proton types used to represent AMQP types.