| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // 0x0fffffff ~3.1 days, the code will not take that long to execute | 67 // 0x0fffffff ~3.1 days, the code will not take that long to execute |
| 68 // so it must have been a wrap around. | 68 // so it must have been a wrap around. |
| 69 if (old > 0xf0000000 && now < 0x0fffffff) { | 69 if (old > 0xf0000000 && now < 0x0fffffff) { |
| 70 num_wrap_timegettime++; | 70 num_wrap_timegettime++; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 ticks = now + (num_wrap_timegettime << 32); | 73 ticks = now + (num_wrap_timegettime << 32); |
| 74 // TODO: Calculate with nanosecond precision. Otherwise, we're just | 74 // TODO: Calculate with nanosecond precision. Otherwise, we're just |
| 75 // wasting a multiply and divide when doing Time() on Windows. | 75 // wasting a multiply and divide when doing Time() on Windows. |
| 76 ticks = ticks * kNumNanosecsPerMillisec; | 76 ticks = ticks * kNumNanosecsPerMillisec; |
| 77 #else |
| 78 #error Unsupported platform. |
| 77 #endif | 79 #endif |
| 78 return ticks; | 80 return ticks; |
| 79 } | 81 } |
| 80 | 82 |
| 81 uint32_t Time() { | 83 uint32_t Time() { |
| 82 return static_cast<uint32_t>(TimeNanos() / kNumNanosecsPerMillisec); | 84 return static_cast<uint32_t>(TimeNanos() / kNumNanosecsPerMillisec); |
| 83 } | 85 } |
| 84 | 86 |
| 85 uint64_t TimeMicros() { | 87 uint64_t TimeMicros() { |
| 86 return static_cast<uint64_t>(TimeNanos() / kNumNanosecsPerMicrosec); | 88 return static_cast<uint64_t>(TimeNanos() / kNumNanosecsPerMicrosec); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (expiry_in_leap_year && month <= 2 - 1) // |month| is zero based. | 244 if (expiry_in_leap_year && month <= 2 - 1) // |month| is zero based. |
| 243 day -= 1; | 245 day -= 1; |
| 244 | 246 |
| 245 // Combine all variables into seconds from 1970-01-01 00:00 (except |month| | 247 // Combine all variables into seconds from 1970-01-01 00:00 (except |month| |
| 246 // which was accumulated into |day| above). | 248 // which was accumulated into |day| above). |
| 247 return (((static_cast<int64_t> | 249 return (((static_cast<int64_t> |
| 248 (year - 1970) * 365 + day) * 24 + hour) * 60 + min) * 60 + sec; | 250 (year - 1970) * 365 + day) * 24 + hour) * 60 + min) * 60 + sec; |
| 249 } | 251 } |
| 250 | 252 |
| 251 } // namespace rtc | 253 } // namespace rtc |
| OLD | NEW |