| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| 11 | 11 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (microseconds >= Time::kMicrosecondsPerSecond) { | 183 if (microseconds >= Time::kMicrosecondsPerSecond) { |
| 184 seconds = InSeconds(); | 184 seconds = InSeconds(); |
| 185 microseconds -= seconds * Time::kMicrosecondsPerSecond; | 185 microseconds -= seconds * Time::kMicrosecondsPerSecond; |
| 186 } | 186 } |
| 187 struct timespec result = | 187 struct timespec result = |
| 188 {seconds, | 188 {seconds, |
| 189 microseconds * Time::kNanosecondsPerMicrosecond}; | 189 microseconds * Time::kNanosecondsPerMicrosecond}; |
| 190 return result; | 190 return result; |
| 191 } | 191 } |
| 192 | 192 |
| 193 struct timeval Time::ToTimeVal() const { |
| 194 struct timeval result; |
| 195 int64 us = us_ - kTimeTToMicrosecondsOffset; |
| 196 result.tv_sec = us / Time::kMicrosecondsPerSecond; |
| 197 result.tv_usec = us % Time::kMicrosecondsPerSecond; |
| 198 return result; |
| 199 } |
| 200 |
| 193 } // namespace base | 201 } // namespace base |
| OLD | NEW |