From e5a3ac2b9761c66f3fc94d489b1363698ae2edf0 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 24 Oct 2016 14:19:28 +0000 Subject: [PATCH] [Chrono] Fix !HAVE_FUTIMENS build If we don't have futimens(), we fall back to futimes(), which only supports microsecond timestamps. In that case, we need to explicitly cast away the extra precision in setLastModificationAndAccessTime(). llvm-svn: 284977 --- lib/Support/Unix/Path.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index d1d0c5d2694..881a2631ec0 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -451,7 +451,8 @@ std::error_code setLastModificationAndAccessTime(int FD, TimePoint<> Time) { return std::error_code(); #elif defined(HAVE_FUTIMES) timeval Times[2]; - Times[0] = Times[1] = sys::toTimeVal(Time); + Times[0] = Times[1] = sys::toTimeVal( + std::chrono::time_point_cast(Time)); if (::futimes(FD, Times)) return std::error_code(errno, std::generic_category()); return std::error_code();