Reinstate "API for periodically regathering ICE candidates"
Use rtc::SystemTimeNanos() instead of std::random_device() for PRNG seed
to avoid crashing when /dev/urandom is unavailable.
This reverts commit 3beb20720db349f651c2c04970c45b1b171c025c.
Bug: webrtc:7969
Change-Id: I5ed58a789939ee4caa99ac3abf9cab18e3e19c69
Reviewed-on: https://chromium-review.googlesource.com/572070
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19033}
diff --git a/webrtc/rtc_base/timeutils.h b/webrtc/rtc_base/timeutils.h
index ea7b17d..c7f035c 100644
--- a/webrtc/rtc_base/timeutils.h
+++ b/webrtc/rtc_base/timeutils.h
@@ -15,6 +15,9 @@
#include <time.h>
#include <ctime>
+#include <string>
+
+#include "webrtc/rtc_base/checks.h"
namespace rtc {
@@ -124,6 +127,32 @@
// measuring time intervals and timeouts.
int64_t TimeUTCMicros();
+// Interval of time from the range [min, max] inclusive.
+class IntervalRange {
+ public:
+ IntervalRange() : min_(0), max_(0) {}
+ IntervalRange(int min, int max) : min_(min), max_(max) {
+ RTC_DCHECK_LE(min, max);
+ }
+
+ int min() const { return min_; }
+ int max() const { return max_; }
+
+ std::string ToString() const {
+ std::stringstream ss;
+ ss << "[" << min_ << "," << max_ << "]";
+ return ss.str();
+ }
+
+ bool operator==(const IntervalRange& o) const {
+ return min_ == o.min_ && max_ == o.max_;
+ }
+
+ private:
+ int min_;
+ int max_;
+};
+
} // namespace rtc
#endif // WEBRTC_RTC_BASE_TIMEUTILS_H_