diff --git a/libcxx/src/filesystem/time_utils.h b/libcxx/src/filesystem/time_utils.h index 89352e5bd6abb..e82738eb70363 100644 --- a/libcxx/src/filesystem/time_utils.h +++ b/libcxx/src/filesystem/time_utils.h @@ -32,8 +32,14 @@ # include // for ::utimes as used in __last_write_time #endif +// MacOS version 10.13 introduces utimensat +#if defined(__APPLE__) +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101300) +# define _LIBCPP_USE_UTIMENSAT +# endif // We can use the presence of UTIME_OMIT to detect platforms that provide utimensat. -#if defined(UTIME_OMIT) +#elif defined(UTIME_OMIT) # define _LIBCPP_USE_UTIMENSAT #endif