Index: base/time.cc |
diff --git a/base/time.cc b/base/time.cc |
index 26fd500403e961b0497cfed93b21aee97e6e9174..415f70717c05ae4c9fd5df1771c8957624e2e389 100644 |
--- a/base/time.cc |
+++ b/base/time.cc |
@@ -116,6 +116,15 @@ double Time::ToDoubleT() const { |
static_cast<double>(kMicrosecondsPerSecond)); |
} |
+#if defined(OS_POSIX) |
+// static |
+Time Time::FromTimeSpec(const timespec& ts) { |
+ return FromDoubleT(ts.tv_sec + |
+ static_cast<double>(ts.tv_nsec) / |
+ base::Time::kNanosecondsPerSecond); |
+} |
+#endif |
+ |
// static |
Time Time::FromJsTime(double ms_since_epoch) { |
// The epoch is a valid time, so this constructor doesn't interpret |