Index: webrtc/rtc_base/time_interval.cc |
diff --git a/webrtc/rtc_base/time_interval.cc b/webrtc/rtc_base/time_interval.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..940c424642dac4c45593df7c23b327ae98e097fd |
--- /dev/null |
+++ b/webrtc/rtc_base/time_interval.cc |
@@ -0,0 +1,44 @@ |
+/* |
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#include "webrtc/rtc_base/time_interval.h" |
+#include "webrtc/rtc_base/timeutils.h" |
+ |
+namespace rtc { |
+ |
+TimeInterval::TimeInterval() {} |
ossu
2017/07/14 11:13:15
= default instead of {}
saza WebRTC
2017/07/17 14:27:29
Done.
|
+TimeInterval::~TimeInterval() {} |
ossu
2017/07/14 11:13:15
Same here.
saza WebRTC
2017/07/17 14:27:29
Done.
|
+ |
+void TimeInterval::Extend() { |
+ Extend(TimeMillis()); |
+} |
+ |
+void TimeInterval::Extend(int64_t time) { |
+ if (!first_ || time < *first_) { |
ossu
2017/07/14 11:13:15
Just a minor detail, but first_ and last_ aren't b
ossu
2017/07/14 15:37:32
Rietveld top-tip: If you reply to the comments ind
saza WebRTC
2017/07/17 14:27:29
Oh, thanks for the tip!
|
+ first_.emplace(time); |
+ } |
+ if (!last_ || *last_ < time) { |
+ last_.emplace(time); |
+ } |
+} |
+ |
+bool TimeInterval::Empty() const { |
+ return !first_; |
+} |
+ |
+Optional<int64_t> TimeInterval::First() const { |
+ return first_; |
+} |
+ |
+Optional<int64_t> TimeInterval::Last() const { |
+ return last_; |
+} |
+ |
+} // namespace rtc |