summaryrefslogtreecommitdiff
path: root/lib/Support/Unix
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-07-04 01:10:38 +0000
committerEric Christopher <echristo@gmail.com>2013-07-04 01:10:38 +0000
commitc589a5f2849620306b14077b16e51a3e0b7ef5cd (patch)
tree30f9655e0c82d579e5f1983d703e77b8d755b3bd /lib/Support/Unix
parent2333a31df5eb20db07818252774c3d943d1497d1 (diff)
downloadllvm-c589a5f2849620306b14077b16e51a3e0b7ef5cd.tar.gz
llvm-c589a5f2849620306b14077b16e51a3e0b7ef5cd.tar.bz2
llvm-c589a5f2849620306b14077b16e51a3e0b7ef5cd.tar.xz
Reapply r185601 with a fix for the cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185605 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/Path.inc10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 1cbdbf5429..e23e0bd618 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -626,11 +626,21 @@ error_code permissions(const Twine &path, perms prms) {
}
error_code setLastModificationAndAccessTime(int FD, TimeValue Time) {
+#if defined(HAVE_FUTIMENS)
+ timespec Times[2];
+ Times[0].tv_sec = Time.toPosixTime();
+ Times[0].tv_nsec = 0;
+ Times[1] = Times[0];
+ if (::futimens(FD, Times))
+#elif defined(HAVE_FUTIMES)
timeval Times[2];
Times[0].tv_sec = Time.toPosixTime();
Times[0].tv_usec = 0;
Times[1] = Times[0];
if (::futimes(FD, Times))
+#else
+#error Missing futimes() and futimens()
+#endif
return error_code(errno, system_category());
return error_code::success();
}