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

Unified Diff: runtime/bin/file_linux.cc

Issue 252123005: Make FileStat have millisecond precisions, for linux, mac and android. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « runtime/bin/file_android.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_linux.cc
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index 4753a8b6cc8c3a634ab6e1985c5a9674233119ce..f8c6674feb21c3d64f8c1a3cb46fcf237863d1a2 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -292,6 +292,12 @@ int64_t File::LengthFromPath(const char* name) {
}
+static int64_t TimespecToMilliseconds(const struct timespec& t) {
+ return static_cast<int64_t>(t.tv_sec) * 1000L +
+ static_cast<int64_t>(t.tv_nsec) / 1000000L;
+}
+
+
void File::Stat(const char* name, int64_t* data) {
struct stat64 st;
if (NO_RETRY_EXPECTED(stat64(name, &st)) == 0) {
@@ -304,9 +310,9 @@ void File::Stat(const char* name, int64_t* data) {
} else {
data[kType] = kDoesNotExist;
}
- data[kCreatedTime] = st.st_ctime;
- data[kModifiedTime] = st.st_mtime;
- data[kAccessedTime] = st.st_atime;
+ data[kCreatedTime] = TimespecToMilliseconds(st.st_ctim);
+ data[kModifiedTime] = TimespecToMilliseconds(st.st_mtim);
+ data[kAccessedTime] = TimespecToMilliseconds(st.st_atim);
data[kMode] = st.st_mode;
data[kSize] = st.st_size;
} else {
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698