| 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.h" | 5 #include "base/time.h" |
| 6 | 6 |
| 7 #include <sys/time.h> | 7 #include <sys/time.h> |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| 11 #include <limits> | 11 #include <limits> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 | 15 |
| 16 #if defined(OS_ANDROID) | 16 #if defined(OS_ANDROID) |
| 17 #include "base/os_compat_android.h" | 17 #include "base/os_compat_android.h" |
| 18 #elif defined(OS_NACL) |
| 19 #include "base/os_compat_nacl.h" |
| 18 #endif | 20 #endif |
| 19 | 21 |
| 20 namespace base { | 22 namespace base { |
| 21 | 23 |
| 22 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
| 23 #define _POSIX_MONOTONIC_CLOCK 1 | 25 #define _POSIX_MONOTONIC_CLOCK 1 |
| 24 #endif | 26 #endif |
| 25 | 27 |
| 26 struct timespec TimeDelta::ToTimeSpec() const { | 28 struct timespec TimeDelta::ToTimeSpec() const { |
| 27 int64 microseconds = InMicroseconds(); | 29 int64 microseconds = InMicroseconds(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 232 |
| 231 struct timeval Time::ToTimeVal() const { | 233 struct timeval Time::ToTimeVal() const { |
| 232 struct timeval result; | 234 struct timeval result; |
| 233 int64 us = us_ - kTimeTToMicrosecondsOffset; | 235 int64 us = us_ - kTimeTToMicrosecondsOffset; |
| 234 result.tv_sec = us / Time::kMicrosecondsPerSecond; | 236 result.tv_sec = us / Time::kMicrosecondsPerSecond; |
| 235 result.tv_usec = us % Time::kMicrosecondsPerSecond; | 237 result.tv_usec = us % Time::kMicrosecondsPerSecond; |
| 236 return result; | 238 return result; |
| 237 } | 239 } |
| 238 | 240 |
| 239 } // namespace base | 241 } // namespace base |
| OLD | NEW |