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

Unified Diff: webrtc/base/timeutils.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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/timeutils.h ('k') | webrtc/base/timeutils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/timeutils.cc
diff --git a/webrtc/base/timeutils.cc b/webrtc/base/timeutils.cc
index ffaf3266cca360590e4511a54392bb98d616a8f5..fac5b66c7e005756d3c405db60752201ff27602f 100644
--- a/webrtc/base/timeutils.cc
+++ b/webrtc/base/timeutils.cc
@@ -32,10 +32,10 @@
namespace rtc {
-const uint32 HALF = 0x80000000;
+const uint32_t HALF = 0x80000000;
-uint64 TimeNanos() {
- int64 ticks = 0;
+uint64_t TimeNanos() {
+ int64_t ticks = 0;
#if defined(WEBRTC_MAC)
static mach_timebase_info_data_t timebase;
if (timebase.denom == 0) {
@@ -52,11 +52,11 @@ uint64 TimeNanos() {
// TODO: Do we need to handle the case when CLOCK_MONOTONIC
// is not supported?
clock_gettime(CLOCK_MONOTONIC, &ts);
- ticks = kNumNanosecsPerSec * static_cast<int64>(ts.tv_sec) +
- static_cast<int64>(ts.tv_nsec);
+ ticks = kNumNanosecsPerSec * static_cast<int64_t>(ts.tv_sec) +
+ static_cast<int64_t>(ts.tv_nsec);
#elif defined(WEBRTC_WIN)
static volatile LONG last_timegettime = 0;
- static volatile int64 num_wrap_timegettime = 0;
+ static volatile int64_t num_wrap_timegettime = 0;
volatile LONG* last_timegettime_ptr = &last_timegettime;
DWORD now = timeGetTime();
// Atomically update the last gotten time
@@ -78,16 +78,16 @@ uint64 TimeNanos() {
return ticks;
}
-uint32 Time() {
- return static_cast<uint32>(TimeNanos() / kNumNanosecsPerMillisec);
+uint32_t Time() {
+ return static_cast<uint32_t>(TimeNanos() / kNumNanosecsPerMillisec);
}
-uint64 TimeMicros() {
- return static_cast<uint64>(TimeNanos() / kNumNanosecsPerMicrosec);
+uint64_t TimeMicros() {
+ return static_cast<uint64_t>(TimeNanos() / kNumNanosecsPerMicrosec);
}
#if defined(WEBRTC_WIN)
-static const uint64 kFileTimeToUnixTimeEpochOffset = 116444736000000000ULL;
+static const uint64_t kFileTimeToUnixTimeEpochOffset = 116444736000000000ULL;
struct timeval {
long tv_sec, tv_usec; // NOLINT
@@ -105,7 +105,7 @@ static int gettimeofday(struct timeval *tv, void *tz) {
li.HighPart = ft.dwHighDateTime;
// Convert to seconds and microseconds since Unix time Epoch.
- int64 micros = (li.QuadPart - kFileTimeToUnixTimeEpochOffset) / 10;
+ int64_t micros = (li.QuadPart - kFileTimeToUnixTimeEpochOffset) / 10;
tv->tv_sec = static_cast<long>(micros / kNumMicrosecsPerSec); // NOLINT
tv->tv_usec = static_cast<long>(micros % kNumMicrosecsPerSec); // NOLINT
@@ -135,13 +135,13 @@ void CurrentTmTime(struct tm *tm, int *microseconds) {
*microseconds = timeval.tv_usec;
}
-uint32 TimeAfter(int32 elapsed) {
+uint32_t TimeAfter(int32_t elapsed) {
RTC_DCHECK_GE(elapsed, 0);
- RTC_DCHECK_LT(static_cast<uint32>(elapsed), HALF);
+ RTC_DCHECK_LT(static_cast<uint32_t>(elapsed), HALF);
return Time() + elapsed;
}
-bool TimeIsBetween(uint32 earlier, uint32 middle, uint32 later) {
+bool TimeIsBetween(uint32_t earlier, uint32_t middle, uint32_t later) {
if (earlier <= later) {
return ((earlier <= middle) && (middle <= later));
} else {
@@ -149,27 +149,27 @@ bool TimeIsBetween(uint32 earlier, uint32 middle, uint32 later) {
}
}
-bool TimeIsLaterOrEqual(uint32 earlier, uint32 later) {
+bool TimeIsLaterOrEqual(uint32_t earlier, uint32_t later) {
#if EFFICIENT_IMPLEMENTATION
- int32 diff = later - earlier;
- return (diff >= 0 && static_cast<uint32>(diff) < HALF);
+ int32_t diff = later - earlier;
+ return (diff >= 0 && static_cast<uint32_t>(diff) < HALF);
#else
const bool later_or_equal = TimeIsBetween(earlier, later, earlier + HALF);
return later_or_equal;
#endif
}
-bool TimeIsLater(uint32 earlier, uint32 later) {
+bool TimeIsLater(uint32_t earlier, uint32_t later) {
#if EFFICIENT_IMPLEMENTATION
- int32 diff = later - earlier;
- return (diff > 0 && static_cast<uint32>(diff) < HALF);
+ int32_t diff = later - earlier;
+ return (diff > 0 && static_cast<uint32_t>(diff) < HALF);
#else
const bool earlier_or_equal = TimeIsBetween(later, earlier, later + HALF);
return !earlier_or_equal;
#endif
}
-int32 TimeDiff(uint32 later, uint32 earlier) {
+int32_t TimeDiff(uint32_t later, uint32_t earlier) {
#if EFFICIENT_IMPLEMENTATION
return later - earlier;
#else
@@ -193,7 +193,7 @@ int32 TimeDiff(uint32 later, uint32 earlier) {
TimestampWrapAroundHandler::TimestampWrapAroundHandler()
: last_ts_(0), num_wrap_(0) {}
-int64 TimestampWrapAroundHandler::Unwrap(uint32 ts) {
+int64_t TimestampWrapAroundHandler::Unwrap(uint32_t ts) {
if (ts < last_ts_) {
if (last_ts_ > 0xf0000000 && ts < 0x0fffffff) {
++num_wrap_;
« no previous file with comments | « webrtc/base/timeutils.h ('k') | webrtc/base/timeutils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698