Skip to content

Commit

Permalink
[Chrono] Fix !HAVE_FUTIMENS build
Browse files Browse the repository at this point in the history
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().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284977 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
labath committed Oct 24, 2016
1 parent a1f02c4 commit f62fc7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Support/Unix/Path.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::chrono::microseconds>(Time));
if (::futimes(FD, Times))
return std::error_code(errno, std::generic_category());
return std::error_code();
Expand Down

0 comments on commit f62fc7a

Please sign in to comment.