Remove TotalOrdering from utils::Timestamp
Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2646
This commit is contained in:
parent
015573b5af
commit
cfbfeb1dfc
@ -8,7 +8,6 @@
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "utils/exceptions.hpp"
|
||||
#include "utils/total_ordering.hpp"
|
||||
|
||||
namespace utils {
|
||||
|
||||
@ -17,7 +16,7 @@ class TimestampError : public StacktraceException {
|
||||
using StacktraceException::StacktraceException;
|
||||
};
|
||||
|
||||
class Timestamp : public TotalOrdering<Timestamp> {
|
||||
class Timestamp final {
|
||||
public:
|
||||
Timestamp() : Timestamp(0, 0) {}
|
||||
|
||||
@ -28,9 +27,6 @@ class Timestamp : public TotalOrdering<Timestamp> {
|
||||
throw TimestampError("Unable to construct from {}", time);
|
||||
}
|
||||
|
||||
Timestamp(const Timestamp &) = default;
|
||||
Timestamp(Timestamp &&) = default;
|
||||
|
||||
static Timestamp Now() {
|
||||
timespec time;
|
||||
clock_gettime(CLOCK_REALTIME, &time);
|
||||
@ -85,6 +81,22 @@ class Timestamp : public TotalOrdering<Timestamp> {
|
||||
(a.unix_time == b.unix_time && a.nsec < b.nsec);
|
||||
}
|
||||
|
||||
constexpr friend bool operator!=(const Timestamp &a, const Timestamp &b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
constexpr friend bool operator<=(const Timestamp &a, const Timestamp &b) {
|
||||
return a < b || a == b;
|
||||
}
|
||||
|
||||
constexpr friend bool operator>(const Timestamp &a, const Timestamp &b) {
|
||||
return !(a <= b);
|
||||
}
|
||||
|
||||
constexpr friend bool operator>=(const Timestamp &a, const Timestamp &b) {
|
||||
return !(a < b);
|
||||
}
|
||||
|
||||
private:
|
||||
std::tm time;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user