Enables comparison with infinite timestamps.
Bug: webrtc:8415
Change-Id: Ia96c7a537d994c281d8b24e648dbb2e17de3ed4a
Reviewed-on: https://webrtc-review.googlesource.com/78182
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23383}
diff --git a/api/units/timestamp.h b/api/units/timestamp.h
index af62b3b..40f3e92 100644
--- a/api/units/timestamp.h
+++ b/api/units/timestamp.h
@@ -78,10 +78,18 @@
bool operator!=(const Timestamp& other) const {
return microseconds_ != other.microseconds_;
}
- bool operator<=(const Timestamp& other) const { return us() <= other.us(); }
- bool operator>=(const Timestamp& other) const { return us() >= other.us(); }
- bool operator>(const Timestamp& other) const { return us() > other.us(); }
- bool operator<(const Timestamp& other) const { return us() < other.us(); }
+ bool operator<=(const Timestamp& other) const {
+ return microseconds_ <= other.microseconds_;
+ }
+ bool operator>=(const Timestamp& other) const {
+ return microseconds_ >= other.microseconds_;
+ }
+ bool operator>(const Timestamp& other) const {
+ return microseconds_ > other.microseconds_;
+ }
+ bool operator<(const Timestamp& other) const {
+ return microseconds_ < other.microseconds_;
+ }
private:
explicit Timestamp(int64_t us) : microseconds_(us) {}