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

Unified Diff: base/platform_file_posix.cc

Issue 13818027: posix: replace nonstandard futimes call with futimens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo stray changes to time_unittest.cc Created 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/platform_file_posix.cc
diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc
index 646c82e8dfd2ec74e6a600a4874f191f360776e9..fa8fc6234bed42d150b493d7e46f6fb58cc49e39 100644
--- a/base/platform_file_posix.cc
+++ b/base/platform_file_posix.cc
@@ -301,7 +301,21 @@ bool TouchPlatformFile(PlatformFile file, const base::Time& last_access_time,
timeval times[2];
times[0] = last_access_time.ToTimeVal();
times[1] = last_modified_time.ToTimeVal();
+
+#ifdef __USE_XOPEN2K8
+ // futimens should be available, but futimes might not be
+ // http://pubs.opengroup.org/onlinepubs/9699919799/
+
+ timespec ts_times[2];
+ ts_times[0].tv_sec = times[0].tv_sec;
+ ts_times[0].tv_nsec = times[0].tv_usec * 1000;
+ ts_times[1].tv_sec = times[1].tv_sec;
+ ts_times[1].tv_nsec = times[1].tv_usec * 1000;
+
+ return !futimens(file, ts_times);
+#else
return !futimes(file, times);
+#endif
}
bool GetPlatformFileInfo(PlatformFile file, PlatformFileInfo* info) {
« 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