Change default timestamp to 64 bits in all webrtc directories.

BUG=
R=pbos@webrtc.org, pthatcher@webrtc.org, solenberg@webrtc.org

Review URL: https://codereview.webrtc.org/1835053002 .

Cr-Commit-Position: refs/heads/master@{#12646}
This commit is contained in:
Honghai Zhang
2016-05-06 11:29:15 -07:00
parent e76db89e0b
commit 82d7862fe7
55 changed files with 294 additions and 361 deletions

View File

@ -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;
}
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'.
int32_t TimeDiff(uint32_t later, uint32_t earlier);
// 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 {