Index: base/time/time_posix.cc |
diff --git a/base/time/time_posix.cc b/base/time/time_posix.cc |
index 495e249f006523cad5e6b8754bb72e604f4f4423..ab2dccb198766e9f3334cf25e9ca23b96cd8d9f3 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; |