1#ifndef PROTON_TIMESTAMP_HPP
2#define PROTON_TIMESTAMP_HPP
25#include <proton/type_compat.h>
35class timestamp :
private internal::comparable<timestamp> {
58inline bool operator==(timestamp x, timestamp y) {
return x.milliseconds() == y.milliseconds(); }
59inline bool operator<(timestamp x, timestamp y) {
return x.milliseconds() < y.milliseconds(); }
61inline timestamp operator+(timestamp ts, duration d) {
return timestamp(ts.milliseconds() + d.milliseconds()); }
62inline timestamp operator-(timestamp ts, duration d) {
return timestamp(ts.milliseconds() - d.milliseconds()); }
63inline duration operator-(timestamp t0, timestamp t1) {
return duration(t0.milliseconds() - t1.milliseconds()); }
64inline 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 & operator=(numeric_type ms)
Assign a value in milliseconds.
Definition: timestamp.hpp:47
timestamp(numeric_type ms=0)
Construct from a value in milliseconds.
Definition: timestamp.hpp:44
static timestamp now()
The current wall-clock time.
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.