Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> | |
|
tzik
2011/06/15 09:38:19
for _POSIX_MONOTONIC_CLOCK
| |
| 9 | 10 |
| 10 #include <limits> | 11 #include <limits> |
| 11 | 12 |
| 12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 | 17 |
| 17 struct timespec TimeDelta::ToTimeSpec() const { | 18 struct timespec TimeDelta::ToTimeSpec() const { |
| 18 int64 microseconds = InMicroseconds(); | 19 int64 microseconds = InMicroseconds(); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 | 204 |
| 204 struct timeval Time::ToTimeVal() const { | 205 struct timeval Time::ToTimeVal() const { |
| 205 struct timeval result; | 206 struct timeval result; |
| 206 int64 us = us_ - kTimeTToMicrosecondsOffset; | 207 int64 us = us_ - kTimeTToMicrosecondsOffset; |
| 207 result.tv_sec = us / Time::kMicrosecondsPerSecond; | 208 result.tv_sec = us / Time::kMicrosecondsPerSecond; |
| 208 result.tv_usec = us % Time::kMicrosecondsPerSecond; | 209 result.tv_usec = us % Time::kMicrosecondsPerSecond; |
| 209 return result; | 210 return result; |
| 210 } | 211 } |
| 211 | 212 |
| 212 } // namespace base | 213 } // namespace base |
| OLD | NEW |