[llvm] r284977 - [Chrono] Fix !HAVE_FUTIMENS build

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 07:19:28 PDT 2016


Author: labath
Date: Mon Oct 24 09:19:28 2016
New Revision: 284977

URL: http://llvm.org/viewvc/llvm-project?rev=284977&view=rev
Log:
[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().

Modified:
    llvm/trunk/lib/Support/Unix/Path.inc

Modified: llvm/trunk/lib/Support/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=284977&r1=284976&r2=284977&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc (original)
+++ llvm/trunk/lib/Support/Unix/Path.inc Mon Oct 24 09:19:28 2016
@@ -451,7 +451,8 @@ std::error_code setLastModificationAndAc
   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<std::chrono::microseconds>(Time));
   if (::futimes(FD, Times))
     return std::error_code(errno, std::generic_category());
   return std::error_code();




More information about the llvm-commits mailing list