diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | lib/common/FileModificationTime.h | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 85b8c968..07f7f3c8 100644 --- a/configure.ac +++ b/configure.ac @@ -159,6 +159,8 @@ AC_TYPE_SIZE_T AC_CHECK_MEMBERS([struct stat.st_flags]) AC_CHECK_MEMBERS([struct stat.st_mtimespec]) +AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec]) +AC_CHECK_MEMBERS([struct stat.st_atimensec]) AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,, [[ #include <sys/types.h> #include <netinet/in.h> diff --git a/lib/common/FileModificationTime.h b/lib/common/FileModificationTime.h index a84df579..c64ca848 100644 --- a/lib/common/FileModificationTime.h +++ b/lib/common/FileModificationTime.h @@ -28,11 +28,18 @@ inline box_time_t FileModificationTime(struct stat &st) inline box_time_t FileAttrModificationTime(struct stat &st) { -#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC - box_time_t statusmodified = ((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL); -#else - box_time_t statusmodified = (((int64_t)st.st_ctimespec.tv_nsec) / NANO_SEC_IN_USEC_LL) - + (((int64_t)st.st_ctimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); + box_time_t statusmodified = +#ifdef HAVE_STRUCT_STAT_ST_MTIMESPEC + (((int64_t)st.st_ctimespec.tv_nsec) / (NANO_SEC_IN_USEC_LL)) + + (((int64_t)st.st_ctimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); +#elif defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC + (((int64_t)st.st_ctim.tv_nsec) / (NANO_SEC_IN_USEC_LL)) + + (((int64_t)st.st_ctim.tv_sec) * (MICRO_SEC_IN_SEC_LL)); +#elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC + (((int64_t)st.st_ctimensec) / (NANO_SEC_IN_USEC_LL)) + + (((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL)); +#else // no nanoseconds anywhere + (((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL)); #endif return statusmodified; |