Index: base/time/time_mac.cc |
diff --git a/base/time/time_mac.cc b/base/time/time_mac.cc |
index e263d07945917f8acf2eb192c9b131c5366e5384..dcad44433589b1e2d63d70496ebdb9811f17bb59 100644 |
--- a/base/time/time_mac.cc |
+++ b/base/time/time_mac.cc |
@@ -13,6 +13,8 @@ |
#include <sys/types.h> |
#include <time.h> |
+#include <limits> |
+ |
#include "base/basictypes.h" |
#include "base/logging.h" |
#include "base/mac/mach_logging.h" |
@@ -21,7 +23,7 @@ |
namespace { |
-uint64_t ComputeCurrentTicks() { |
+int64 ComputeCurrentTicks() { |
#if defined(OS_IOS) |
// On iOS mach_absolute_time stops while the device is sleeping. Instead use |
// now - KERN_BOOTTIME to get a time difference that is not impacted by clock |
@@ -59,15 +61,17 @@ uint64_t ComputeCurrentTicks() { |
absolute_micro = |
mach_absolute_time() / base::Time::kNanosecondsPerMicrosecond * |
timebase_info.numer / timebase_info.denom; |
+ DCHECK_LE(absolute_micro, |
+ static_cast<uint64_t>(std::numeric_limits<int64>::max())); |
// Don't bother with the rollover handling that the Windows version does. |
// With numer and denom = 1 (the expected case), the 64-bit absolute time |
// reported in nanoseconds is enough to last nearly 585 years. |
- return absolute_micro; |
+ return static_cast<int64>(absolute_micro); |
#endif // defined(OS_IOS) |
} |
-uint64_t ComputeThreadTicks() { |
+int64 ComputeThreadTicks() { |
#if defined(OS_IOS) |
NOTREACHED(); |
return 0; |
@@ -224,13 +228,13 @@ bool TimeTicks::IsHighResolution() { |
} |
// static |
-TimeTicks TimeTicks::ThreadNow() { |
- return TimeTicks(ComputeThreadTicks()); |
+ThreadTicks ThreadTicks::Now() { |
+ return ThreadTicks(ComputeThreadTicks()); |
} |
// static |
-TimeTicks TimeTicks::NowFromSystemTraceTime() { |
- return Now(); |
+TraceTicks TraceTicks::Now() { |
+ return TraceTicks(ComputeCurrentTicks()); |
} |
} // namespace base |