Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: base/time.cc

Issue 16093026: Provide nanoseconds precision for base::PlatformFileInfo on POSIX (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: st_?time_nsec doe not exist in the bots' NDK, use FromTimeT for Android Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/time.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « base/time.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698