OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #endif | 68 #endif |
69 result.ticks_ = 1000000000LL * static_cast<int64_t>(ts.tv_sec) + | 69 result.ticks_ = 1000000000LL * static_cast<int64_t>(ts.tv_sec) + |
70 static_cast<int64_t>(ts.tv_nsec); | 70 static_cast<int64_t>(ts.tv_nsec); |
71 #elif defined(WEBRTC_MAC) | 71 #elif defined(WEBRTC_MAC) |
72 static mach_timebase_info_data_t timebase; | 72 static mach_timebase_info_data_t timebase; |
73 if (timebase.denom == 0) { | 73 if (timebase.denom == 0) { |
74 // Get the timebase if this is the first time we run. | 74 // Get the timebase if this is the first time we run. |
75 // Recommended by Apple's QA1398. | 75 // Recommended by Apple's QA1398. |
76 kern_return_t retval = mach_timebase_info(&timebase); | 76 kern_return_t retval = mach_timebase_info(&timebase); |
77 if (retval != KERN_SUCCESS) { | 77 if (retval != KERN_SUCCESS) { |
78 // TODO(wu): Implement CHECK similar to chrome for all the platforms. | 78 // TODO(wu): Implement RTC_CHECK for all the platforms. Then replace this |
79 // Then replace this with a CHECK(retval == KERN_SUCCESS); | 79 // with a RTC_CHECK_EQ(retval, KERN_SUCCESS); |
80 #ifndef WEBRTC_IOS | 80 #ifndef WEBRTC_IOS |
81 asm("int3"); | 81 asm("int3"); |
82 #else | 82 #else |
83 __builtin_trap(); | 83 __builtin_trap(); |
84 #endif // WEBRTC_IOS | 84 #endif // WEBRTC_IOS |
85 } | 85 } |
86 } | 86 } |
87 // Use timebase to convert absolute time tick units into nanoseconds. | 87 // Use timebase to convert absolute time tick units into nanoseconds. |
88 result.ticks_ = mach_absolute_time() * timebase.numer / timebase.denom; | 88 result.ticks_ = mach_absolute_time() * timebase.numer / timebase.denom; |
89 #else | 89 #else |
90 struct timeval tv; | 90 struct timeval tv; |
91 gettimeofday(&tv, NULL); | 91 gettimeofday(&tv, NULL); |
92 result.ticks_ = 1000000LL * static_cast<int64_t>(tv.tv_sec) + | 92 result.ticks_ = 1000000LL * static_cast<int64_t>(tv.tv_sec) + |
93 static_cast<int64_t>(tv.tv_usec); | 93 static_cast<int64_t>(tv.tv_usec); |
94 #endif | 94 #endif |
95 return result.ticks_; | 95 return result.ticks_; |
96 } | 96 } |
97 | 97 |
98 } // namespace webrtc | 98 } // namespace webrtc |
OLD | NEW |