1 #ifndef PROTON_TIMESTAMP_HPP
2 #define PROTON_TIMESTAMP_HPP
25 #include <proton/type_compat.h>
35 class timestamp :
private internal::comparable<timestamp> {
58 inline bool operator==(timestamp x, timestamp y) {
return x.milliseconds() == y.milliseconds(); }
59 inline bool operator<(timestamp x, timestamp y) {
return x.milliseconds() < y.milliseconds(); }
61 inline timestamp operator+(timestamp ts, duration d) {
return timestamp(ts.milliseconds() + d.milliseconds()); }
62 inline timestamp operator-(timestamp ts, duration d) {
return timestamp(ts.milliseconds() - d.milliseconds()); }
63 inline duration operator-(timestamp t0, timestamp t1) {
return duration(t0.milliseconds() - t1.milliseconds()); }
64 inline timestamp operator+(duration d, timestamp ts) {
return ts + d; }
A 64-bit timestamp in milliseconds since the Unix epoch.
Definition: timestamp.hpp:35
int64_t numeric_type
A numeric type holding a value in milliseconds.
Definition: timestamp.hpp:38
timestamp(numeric_type ms=0)
Construct from a value in milliseconds.
Definition: timestamp.hpp:44
static timestamp now()
The current wall-clock time.
timestamp & operator=(numeric_type ms)
Assign a value in milliseconds.
Definition: timestamp.hpp:47
numeric_type milliseconds() const
Get the value in milliseconds.
Definition: timestamp.hpp:50
A span of time in milliseconds.
The main Proton namespace.
Definition: annotation_key.hpp:33
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.