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

Unified Diff: runtime/bin/file_macos.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_linux.cc ('k') | runtime/bin/file_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_macos.cc
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc
index b5a1dd009d628dfc9e4c853c3f886661b9153037..9b0b2ada0db3f5ddd445f0d380fc6acd4951ff96 100644
--- a/runtime/bin/file_macos.cc
+++ b/runtime/bin/file_macos.cc
@@ -250,6 +250,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 stat st;
if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
@@ -265,6 +271,9 @@ void File::Stat(const char* name, int64_t* data) {
data[kCreatedTime] = st.st_ctime;
data[kModifiedTime] = st.st_mtime;
data[kAccessedTime] = st.st_atime;
+ data[kCreatedTime] = TimespecToMilliseconds(st.st_ctimespec);
+ data[kModifiedTime] = TimespecToMilliseconds(st.st_mtimespec);
+ data[kAccessedTime] = TimespecToMilliseconds(st.st_atimespec);
data[kMode] = st.st_mode;
data[kSize] = st.st_size;
} else {
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698