Index: base/time_posix.cc |
diff --git a/base/time_posix.cc b/base/time_posix.cc |
index 288c646309f9682335e1ef9496b1d632fbf88948..1f8a9093e08ce9bcf4242342ff4431e6da7dd93f 100644 |
--- a/base/time_posix.cc |
+++ b/base/time_posix.cc |
@@ -305,21 +305,21 @@ Time Time::FromTimeVal(struct timeval t) { |
kTimeTToMicrosecondsOffset); |
} |
-struct timeval Time::ToTimeVal() const { |
- struct timeval result; |
+struct timespec Time::ToTimeSpec() const { |
+ struct timespec result; |
if (is_null()) { |
result.tv_sec = 0; |
- result.tv_usec = 0; |
+ result.tv_nsec = 0; |
return result; |
} |
if (is_max()) { |
result.tv_sec = std::numeric_limits<time_t>::max(); |
- result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; |
+ result.tv_nsec = static_cast<long>(Time::kNanosecondsPerSecond) - 1; |
return result; |
} |
int64 us = us_ - kTimeTToMicrosecondsOffset; |
result.tv_sec = us / Time::kMicrosecondsPerSecond; |
- result.tv_usec = us % Time::kMicrosecondsPerSecond; |
+ result.tv_nsec = (us % Time::kMicrosecondsPerSecond) * 1000; |
return result; |
} |