This increases file timestamp precision on some BSD-based OSes.
Closes #1369.
endforeach()
include(CheckStructHasMember)
+
check_struct_has_member("struct stat" st_atim sys/stat.h
HAVE_STRUCT_STAT_ST_ATIM LANGUAGE CXX)
+check_struct_has_member("struct stat" st_atimensec sys/stat.h
+ HAVE_STRUCT_STAT_ST_ATIMENSEC LANGUAGE CXX)
check_struct_has_member("struct stat" st_atimespec sys/stat.h
HAVE_STRUCT_STAT_ST_ATIMESPEC LANGUAGE CXX)
+
check_struct_has_member("struct stat" st_ctim sys/stat.h
HAVE_STRUCT_STAT_ST_CTIM LANGUAGE CXX)
+check_struct_has_member("struct stat" st_ctimensec sys/stat.h
+ HAVE_STRUCT_STAT_ST_CTIMENSEC LANGUAGE CXX)
check_struct_has_member("struct stat" st_ctimespec sys/stat.h
HAVE_STRUCT_STAT_ST_CTIMESPEC LANGUAGE CXX)
+
check_struct_has_member("struct stat" st_mtim sys/stat.h
HAVE_STRUCT_STAT_ST_MTIM LANGUAGE CXX)
+check_struct_has_member("struct stat" st_mtimensec sys/stat.h
+ HAVE_STRUCT_STAT_ST_MTIMENSEC LANGUAGE CXX)
check_struct_has_member("struct stat" st_mtimespec sys/stat.h
HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE CXX)
+
check_struct_has_member("struct statfs" f_fstypename sys/mount.h
HAVE_STRUCT_STATFS_F_FSTYPENAME LANGUAGE CXX)
// Define if "st_atim" is a member of "struct stat".
#cmakedefine HAVE_STRUCT_STAT_ST_ATIM
+// Define if "st_atimensec" is a member of "struct stat".
+#cmakedefine HAVE_STRUCT_STAT_ST_ATIMENSEC
+
// Define if "st_atimespec" is a member of "struct stat".
#cmakedefine HAVE_STRUCT_STAT_ST_ATIMESPEC
// Define if "st_ctim" is a member of "struct stat".
#cmakedefine HAVE_STRUCT_STAT_ST_CTIM
+// Define if "st_ctimensec" is a member of "struct stat".
+#cmakedefine HAVE_STRUCT_STAT_ST_CTIMENSEC
+
// Define if "st_ctimespec" is a member of "struct stat".
#cmakedefine HAVE_STRUCT_STAT_ST_CTIMESPEC
// Define if "st_mtim" is a member of "struct stat".
#cmakedefine HAVE_STRUCT_STAT_ST_MTIM
+// Define if "st_mtimensec" is a member of "struct stat".
+#cmakedefine HAVE_STRUCT_STAT_ST_MTIMENSEC
+
// Define if "st_mtimespec" is a member of "struct stat".
#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC
return util::TimePoint(do_stat().st_atim);
#elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC)
return util::TimePoint(do_stat().st_atimespec);
+#elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)
+ return util::TimePoint(do_stat().st_atime, do_stat().st_atimensec);
#else
return util::TimePoint(do_stat().st_atime, 0);
#endif
return util::TimePoint(do_stat().st_ctim);
#elif defined(HAVE_STRUCT_STAT_ST_CTIMESPEC)
return util::TimePoint(do_stat().st_ctimespec);
+#elif defined(HAVE_STRUCT_STAT_ST_CTIMENSEC)
+ return util::TimePoint(do_stat().st_ctime, do_stat().st_ctimensec);
#else
return util::TimePoint(do_stat().st_ctime, 0);
#endif
{
#if defined(_WIN32) || defined(HAVE_STRUCT_STAT_ST_MTIM)
return util::TimePoint(do_stat().st_mtim);
-#elif defined(HAVE_STRUCT_STAT_ST_CTIMESPEC)
+#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC)
return util::TimePoint(do_stat().st_mtimespec);
+#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC)
+ return util::TimePoint(do_stat().st_mtime, do_stat().st_mtimensec);
#else
return util::TimePoint(do_stat().st_mtime, 0);
#endif