diff options
-rw-r--r-- | infrastructure/m4/boxbackup_tests.m4 | 3 | ||||
-rw-r--r-- | lib/common/FileModificationTime.cpp | 14 |
2 files changed, 12 insertions, 5 deletions
diff --git a/infrastructure/m4/boxbackup_tests.m4 b/infrastructure/m4/boxbackup_tests.m4 index 9e6bc2f2..14902809 100644 --- a/infrastructure/m4/boxbackup_tests.m4 +++ b/infrastructure/m4/boxbackup_tests.m4 @@ -186,7 +186,8 @@ AC_TYPE_PID_T 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]) +AC_CHECK_MEMBERS([struct stat.st_atimespec]) AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec]) AC_CHECK_MEMBERS([struct stat.st_atimensec]) AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,, [[ diff --git a/lib/common/FileModificationTime.cpp b/lib/common/FileModificationTime.cpp index 06fc7887..50f1fb62 100644 --- a/lib/common/FileModificationTime.cpp +++ b/lib/common/FileModificationTime.cpp @@ -18,11 +18,14 @@ box_time_t FileModificationTime(const EMU_STRUCT_STAT &st) { -#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC - box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL); -#else +#if defined HAVE_STRUCT_STAT_ST_ATIM + box_time_t datamodified = (((int64_t)st.st_mtim.tv_nsec) / NANO_SEC_IN_USEC_LL) + + (((int64_t)st.st_mtim.tv_sec) * (MICRO_SEC_IN_SEC_LL)); +#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC box_time_t datamodified = (((int64_t)st.st_mtimespec.tv_nsec) / NANO_SEC_IN_USEC_LL) + (((int64_t)st.st_mtimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); +#else + box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL); #endif return datamodified; @@ -31,7 +34,10 @@ box_time_t FileModificationTime(const EMU_STRUCT_STAT &st) box_time_t FileAttrModificationTime(const EMU_STRUCT_STAT &st) { box_time_t statusmodified = -#ifdef HAVE_STRUCT_STAT_ST_MTIMESPEC +#if defined HAVE_STRUCT_STAT_ST_ATIM + (((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_ATIMESPEC (((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 |