Index: base/time/time_posix.cc |
diff --git a/base/time/time_posix.cc b/base/time/time_posix.cc |
index 0897f9c64e64e669d64c122d7a3b6c8852a082a4..b049f367d32a9528a96998d9f06f80ef8dfdb1fc 100644 |
--- a/base/time/time_posix.cc |
+++ b/base/time/time_posix.cc |
@@ -110,6 +110,12 @@ int64_t ClockNow(clockid_t clk_id) { |
namespace base { |
+// static |
+TimeDelta TimeDelta::FromTimeSpec(const timespec& ts) { |
+ return TimeDelta(ts.tv_sec * Time::kMicrosecondsPerSecond + |
+ ts.tv_nsec / Time::kNanosecondsPerMicrosecond); |
+} |
+ |
struct timespec TimeDelta::ToTimeSpec() const { |
int64_t microseconds = InMicroseconds(); |
time_t seconds = 0; |