| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/time/time.h" | 5 #include "base/time/time.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 7 #include <sys/time.h> | 8 #include <sys/time.h> |
| 8 #include <time.h> | 9 #include <time.h> |
| 9 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
| 10 #include <time64.h> | 11 #include <time64.h> |
| 11 #endif | 12 #endif |
| 13 #include <unistd.h> |
| 12 | 14 |
| 13 #include <limits> | 15 #include <limits> |
| 16 #include <ostream> |
| 14 | 17 |
| 15 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
| 16 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/port.h" |
| 21 #include "build/build_config.h" |
| 17 | 22 |
| 18 #if defined(OS_ANDROID) | 23 #if defined(OS_ANDROID) |
| 19 #include "base/os_compat_android.h" | 24 #include "base/os_compat_android.h" |
| 20 #elif defined(OS_NACL) | 25 #elif defined(OS_NACL) |
| 21 #include "base/os_compat_nacl.h" | 26 #include "base/os_compat_nacl.h" |
| 22 #endif | 27 #endif |
| 23 | 28 |
| 24 namespace { | 29 namespace { |
| 25 | 30 |
| 26 // Define a system-specific SysTime that wraps either to a time_t or | 31 // Define a system-specific SysTime that wraps either to a time_t or |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; | 340 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; |
| 336 return result; | 341 return result; |
| 337 } | 342 } |
| 338 int64 us = us_ - kTimeTToMicrosecondsOffset; | 343 int64 us = us_ - kTimeTToMicrosecondsOffset; |
| 339 result.tv_sec = us / Time::kMicrosecondsPerSecond; | 344 result.tv_sec = us / Time::kMicrosecondsPerSecond; |
| 340 result.tv_usec = us % Time::kMicrosecondsPerSecond; | 345 result.tv_usec = us % Time::kMicrosecondsPerSecond; |
| 341 return result; | 346 return result; |
| 342 } | 347 } |
| 343 | 348 |
| 344 } // namespace base | 349 } // namespace base |
| OLD | NEW |