Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: webrtc/base/timeutils.h

Issue 1835053002: Change default timestamp to 64 bits in all webrtc directories. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add TODO for timestamp. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/thread.cc ('k') | webrtc/base/timeutils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/timeutils.h
diff --git a/webrtc/base/timeutils.h b/webrtc/base/timeutils.h
index 52edbbf3245fd302ec7846890565a098ca7e9cc8..222d5c26e4774efc568736bd2f9fcfa417978ed1 100644
--- a/webrtc/base/timeutils.h
+++ b/webrtc/base/timeutils.h
@@ -29,58 +29,40 @@ static const int64_t kNumNanosecsPerMillisec =
static const int64_t kNumNanosecsPerMicrosec =
kNumNanosecsPerSec / kNumMicrosecsPerSec;
-typedef uint32_t TimeStamp;
+// TODO(honghaiz): Define a type for the time value specifically.
// Returns the current time in milliseconds in 32 bits.
uint32_t Time32();
// Returns the current time in milliseconds in 64 bits.
int64_t TimeMillis();
-
-// Returns the current time in milliseconds.
-// TODO(honghaiz): Change to return TimeMillis() once majority of the webrtc
-// code migrates to 64-bit timestamp.
-inline uint32_t Time() {
- return Time32();
+// Deprecated. Do not use this in any new code.
+inline int64_t Time() {
+ return TimeMillis();
}
// Returns the current time in microseconds.
uint64_t TimeMicros();
+
// Returns the current time in nanoseconds.
uint64_t TimeNanos();
// Returns a future timestamp, 'elapsed' milliseconds from now.
-uint32_t TimeAfter(int32_t elapsed);
-
-bool TimeIsLaterOrEqual(uint32_t earlier, uint32_t later); // Inclusive
-bool TimeIsLater(uint32_t earlier, uint32_t later); // Exclusive
-
-// Returns the later of two timestamps.
-inline uint32_t TimeMax(uint32_t ts1, uint32_t ts2) {
- return TimeIsLaterOrEqual(ts1, ts2) ? ts2 : ts1;
-}
-
-// Returns the earlier of two timestamps.
-inline uint32_t TimeMin(uint32_t ts1, uint32_t ts2) {
- return TimeIsLaterOrEqual(ts1, ts2) ? ts1 : ts2;
-}
-
-// Number of milliseconds that would elapse between 'earlier' and 'later'
-// timestamps. The value is negative if 'later' occurs before 'earlier'.
-int32_t TimeDiff(uint32_t later, uint32_t earlier);
+int64_t TimeAfter(int64_t elapsed);
// Number of milliseconds that would elapse between 'earlier' and 'later'
// timestamps. The value is negative if 'later' occurs before 'earlier'.
-int64_t TimeDiff64(int64_t later, int64_t earlier);
+int64_t TimeDiff(int64_t later, int64_t earlier);
+int32_t TimeDiff32(uint32_t later, uint32_t earlier);
// The number of milliseconds that have elapsed since 'earlier'.
-inline int32_t TimeSince(uint32_t earlier) {
- return TimeDiff(Time(), earlier);
+inline int64_t TimeSince(int64_t earlier) {
+ return TimeMillis() - earlier;
}
// The number of milliseconds that will elapse between now and 'later'.
-inline int32_t TimeUntil(uint32_t later) {
- return TimeDiff(later, Time());
+inline int64_t TimeUntil(uint64_t later) {
+ return later - TimeMillis();
}
class TimestampWrapAroundHandler {
« no previous file with comments | « webrtc/base/thread.cc ('k') | webrtc/base/timeutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698