 Chromium Code Reviews
 Chromium Code Reviews Issue 1835053002:
  Change default timestamp to 64 bits in all webrtc directories.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc@master
    
  
    Issue 1835053002:
  Change default timestamp to 64 bits in all webrtc directories.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc@master| Index: webrtc/base/timeutils.h | 
| diff --git a/webrtc/base/timeutils.h b/webrtc/base/timeutils.h | 
| index f0269b572fced331fc304d0773958fd838d68efc..cd1b7860462eb60c1db22e6b228e3ffe7e5e6eea 100644 | 
| --- a/webrtc/base/timeutils.h | 
| +++ b/webrtc/base/timeutils.h | 
| @@ -32,19 +32,16 @@ static const int64_t kNumNanosecsPerMicrosec = | 
| // January 1970, in NTP milliseconds. | 
| static const int64_t kJan1970AsNtpMillisecs = INT64_C(2208988800000); | 
| -typedef uint32_t TimeStamp; | 
| - | 
| // Returns the current time in milliseconds in 32 bits. | 
| uint32_t Time32(); | 
| // Returns the current time in milliseconds in 64 bits. | 
| +// TODO(honghaiz): remove this and replace the call with Time(). | 
| int64_t Time64(); | 
| // Returns the current time in milliseconds. | 
| -// TODO(honghaiz): Returns Time64 once majority of the webrtc code migrates to | 
| -// 64-bit timestamp. | 
| -inline uint32_t Time() { | 
| - return Time32(); | 
| +inline int64_t Time() { | 
| + return Time64(); | 
| } | 
| // Returns the current time in microseconds. | 
| @@ -56,41 +53,23 @@ uint64_t TimeNanos(); | 
| void CurrentTmTime(struct tm *tm, int *microseconds); | 
| // Returns a future timestamp, 'elapsed' milliseconds from now. | 
| -uint32_t TimeAfter(int32_t elapsed); | 
| - | 
| -// Comparisons between time values, which can wrap around. | 
| -bool TimeIsBetween(uint32_t earlier, | 
| - uint32_t middle, | 
| - uint32_t later); // Inclusive | 
| -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(int elapsed); | 
| 
Taylor Brandstetter
2016/04/05 01:08:14
Why take an int parameter instead of int64_t? Some
 
pthatcher1
2016/04/11 20:56:59
I agree.  Using int64_t consistently seems like a
 
honghaiz3
2016/04/18 23:39:04
Done.
 | 
| // 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); | 
| +inline int TimeDiff(int64_t later, int64_t earlier) { | 
| + return static_cast<int>(TimeDiff64(later, earlier)); | 
| +} | 
| // The number of milliseconds that have elapsed since 'earlier'. | 
| -inline int32_t TimeSince(uint32_t earlier) { | 
| - return TimeDiff(Time(), earlier); | 
| +inline int TimeSince(int64_t earlier) { | 
| 
Taylor Brandstetter
2016/04/05 01:08:14
Similarly, why do these return ints?
 
honghaiz3
2016/04/18 23:39:04
For all delta-time (e.g. elapsed time, or time del
 
Taylor Brandstetter
2016/04/19 20:35:27
See my other comment.
 
honghaiz3
2016/04/22 23:45:20
Done.
 | 
| + return static_cast<int>(Time() - earlier); | 
| } | 
| // The number of milliseconds that will elapse between now and 'later'. | 
| -inline int32_t TimeUntil(uint32_t later) { | 
| - return TimeDiff(later, Time()); | 
| +inline int TimeUntil(uint64_t later) { | 
| + return static_cast<int>(later - Time()); | 
| } | 
| // Converts a unix timestamp in nanoseconds to an NTP timestamp in ms. |