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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // Combine all variables into seconds from 1970-01-01 00:00 (except |month| | 183 // Combine all variables into seconds from 1970-01-01 00:00 (except |month| |
184 // which was accumulated into |day| above). | 184 // which was accumulated into |day| above). |
185 return (((static_cast<int64_t> | 185 return (((static_cast<int64_t> |
186 (year - 1970) * 365 + day) * 24 + hour) * 60 + min) * 60 + sec; | 186 (year - 1970) * 365 + day) * 24 + hour) * 60 + min) * 60 + sec; |
187 } | 187 } |
188 | 188 |
189 int64_t TimeUTCMicros() { | 189 int64_t TimeUTCMicros() { |
190 #if defined(WEBRTC_POSIX) | 190 #if defined(WEBRTC_POSIX) |
191 struct timeval time; | 191 struct timeval time; |
192 gettimeofday(&time, NULL); | 192 gettimeofday(&time, nullptr); |
193 // Convert from second (1.0) and microsecond (1e-6). | 193 // Convert from second (1.0) and microsecond (1e-6). |
194 return (static_cast<int64_t>(time.tv_sec) * rtc::kNumMicrosecsPerSec + | 194 return (static_cast<int64_t>(time.tv_sec) * rtc::kNumMicrosecsPerSec + |
195 time.tv_usec); | 195 time.tv_usec); |
196 | 196 |
197 #elif defined(WEBRTC_WIN) | 197 #elif defined(WEBRTC_WIN) |
198 struct _timeb time; | 198 struct _timeb time; |
199 _ftime(&time); | 199 _ftime(&time); |
200 // Convert from second (1.0) and milliseconds (1e-3). | 200 // Convert from second (1.0) and milliseconds (1e-3). |
201 return (static_cast<int64_t>(time.time) * rtc::kNumMicrosecsPerSec + | 201 return (static_cast<int64_t>(time.time) * rtc::kNumMicrosecsPerSec + |
202 static_cast<int64_t>(time.millitm) * rtc::kNumMicrosecsPerMillisec); | 202 static_cast<int64_t>(time.millitm) * rtc::kNumMicrosecsPerMillisec); |
203 #endif | 203 #endif |
204 } | 204 } |
205 | 205 |
206 } // namespace rtc | 206 } // namespace rtc |
OLD | NEW |