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

Unified Diff: base/file_util_posix.cc

Issue 16093026: Provide nanoseconds precision for base::PlatformFileInfo on POSIX (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 7ef09a200de29c96c1f3f49e7002e50798488ec0..02d99ce9e099ccceafcbfa54f5f0bf52ed155f18 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -588,9 +588,15 @@ bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* results) {
return false;
results->is_directory = S_ISDIR(file_info.st_mode);
results->size = file_info.st_size;
- results->last_modified = base::Time::FromTimeT(file_info.st_mtime);
- results->last_accessed = base::Time::FromTimeT(file_info.st_atime);
- results->creation_time = base::Time::FromTimeT(file_info.st_ctime);
+ results->last_modified = base::Time::FromDoubleT(file_info.st_mtim.tv_sec +
+ static_cast<double>(file_info.st_mtim.tv_nsec) /
+ base::Time::kNanosecondsPerSecond);
+ results->last_accessed = base::Time::FromDoubleT(file_info.st_atim.tv_sec +
+ static_cast<double>(file_info.st_atim.tv_nsec) /
+ base::Time::kNanosecondsPerSecond);
+ results->creation_time = base::Time::FromDoubleT(file_info.st_ctim.tv_sec +
+ static_cast<double>(file_info.st_ctim.tv_nsec) /
+ base::Time::kNanosecondsPerSecond);
tzik 2013/06/05 04:00:17 Can we add Time::FromTimeSpec(const timespec&) and
apavlov 2013/06/05 17:03:41 Done.
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698