Index: webrtc/system_wrappers/include/tick_util.h |
diff --git a/webrtc/system_wrappers/include/tick_util.h b/webrtc/system_wrappers/include/tick_util.h |
index f839ff646cfd459110506db8d1336479ef10c883..6e3b05edb23d77e9e164550e0e004e22481d9afa 100644 |
--- a/webrtc/system_wrappers/include/tick_util.h |
+++ b/webrtc/system_wrappers/include/tick_util.h |
@@ -56,6 +56,8 @@ class TickTime { |
static int64_t TicksToMilliseconds(const int64_t ticks); |
+ static int64_t TicksToMicroseconds(const int64_t ticks); |
+ |
// Returns a TickTime that is ticks later than the passed TickTime. |
friend TickTime operator+(const TickTime lhs, const int64_t ticks); |
TickTime& operator+=(const int64_t& ticks); |
@@ -112,6 +114,14 @@ class TickInterval { |
int64_t interval_; |
}; |
+inline int64_t TickInterval::Milliseconds() const { |
+ return TickTime::TicksToMilliseconds(interval_); |
+} |
+ |
+inline int64_t TickInterval::Microseconds() const { |
+ return TickTime::TicksToMicroseconds(interval_); |
+} |
+ |
inline TickInterval operator+(const TickInterval& lhs, |
const TickInterval& rhs) { |
return TickInterval(lhs.interval_ + rhs.interval_); |
@@ -163,76 +173,10 @@ inline TickTime TickTime::Now() { |
return TickTime(QueryOsForTicks()); |
} |
-inline int64_t TickTime::MillisecondTimestamp() { |
- int64_t ticks = TickTime::Now().Ticks(); |
-#if _WIN32 |
-#ifdef USE_QUERY_PERFORMANCE_COUNTER |
- LARGE_INTEGER qpfreq; |
- QueryPerformanceFrequency(&qpfreq); |
- return (ticks * 1000) / qpfreq.QuadPart; |
-#else |
- return ticks; |
-#endif |
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) |
- return ticks / 1000000LL; |
-#else |
- return ticks / 1000LL; |
-#endif |
-} |
- |
-inline int64_t TickTime::MicrosecondTimestamp() { |
- int64_t ticks = TickTime::Now().Ticks(); |
-#if _WIN32 |
-#ifdef USE_QUERY_PERFORMANCE_COUNTER |
- LARGE_INTEGER qpfreq; |
- QueryPerformanceFrequency(&qpfreq); |
- return (ticks * 1000) / (qpfreq.QuadPart / 1000); |
-#else |
- return ticks * 1000LL; |
-#endif |
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) |
- return ticks / 1000LL; |
-#else |
- return ticks; |
-#endif |
-} |
- |
inline int64_t TickTime::Ticks() const { |
return ticks_; |
} |
-inline int64_t TickTime::MillisecondsToTicks(const int64_t ms) { |
-#if _WIN32 |
-#ifdef USE_QUERY_PERFORMANCE_COUNTER |
- LARGE_INTEGER qpfreq; |
- QueryPerformanceFrequency(&qpfreq); |
- return (qpfreq.QuadPart * ms) / 1000; |
-#else |
- return ms; |
-#endif |
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) |
- return ms * 1000000LL; |
-#else |
- return ms * 1000LL; |
-#endif |
-} |
- |
-inline int64_t TickTime::TicksToMilliseconds(const int64_t ticks) { |
-#if _WIN32 |
-#ifdef USE_QUERY_PERFORMANCE_COUNTER |
- LARGE_INTEGER qpfreq; |
- QueryPerformanceFrequency(&qpfreq); |
- return (ticks * 1000) / qpfreq.QuadPart; |
-#else |
- return ticks; |
-#endif |
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) |
- return ticks / 1000000LL; |
-#else |
- return ticks / 1000LL; |
-#endif |
-} |
- |
inline TickTime& TickTime::operator+=(const int64_t& ticks) { |
ticks_ += ticks; |
return *this; |
@@ -245,44 +189,6 @@ inline TickInterval::TickInterval(const int64_t interval) |
: interval_(interval) { |
} |
-inline int64_t TickInterval::Milliseconds() const { |
-#if _WIN32 |
-#ifdef USE_QUERY_PERFORMANCE_COUNTER |
- LARGE_INTEGER qpfreq; |
- QueryPerformanceFrequency(&qpfreq); |
- return (interval_ * 1000) / qpfreq.QuadPart; |
-#else |
- // interval_ is in ms |
- return interval_; |
-#endif |
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) |
- // interval_ is in ns |
- return interval_ / 1000000; |
-#else |
- // interval_ is usecs |
- return interval_ / 1000; |
-#endif |
-} |
- |
-inline int64_t TickInterval::Microseconds() const { |
-#if _WIN32 |
-#ifdef USE_QUERY_PERFORMANCE_COUNTER |
- LARGE_INTEGER qpfreq; |
- QueryPerformanceFrequency(&qpfreq); |
- return (interval_ * 1000000) / qpfreq.QuadPart; |
-#else |
- // interval_ is in ms |
- return interval_ * 1000LL; |
-#endif |
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) |
- // interval_ is in ns |
- return interval_ / 1000; |
-#else |
- // interval_ is usecs |
- return interval_; |
-#endif |
-} |
- |
inline TickInterval& TickInterval::operator+=(const TickInterval& rhs) { |
interval_ += rhs.interval_; |
return *this; |