Changeset 2080

Show
Ignore:
Timestamp:
31/01/2008 23:43:24 (2 years ago)
Author:
chris
Message:

Add support for nanosecond timestamps in struct stat on Linux.

Location:
box/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • box/trunk/configure.ac

    r2077 r2080  
    160160AC_CHECK_MEMBERS([struct stat.st_flags]) 
    161161AC_CHECK_MEMBERS([struct stat.st_mtimespec]) 
     162AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec]) 
     163AC_CHECK_MEMBERS([struct stat.st_atimensec]) 
    162164AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,, [[ 
    163165  #include <sys/types.h> 
  • box/trunk/lib/common/FileModificationTime.h

    r217 r2080  
    2929inline box_time_t FileAttrModificationTime(struct stat &st) 
    3030{ 
    31 #ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC 
    32         box_time_t statusmodified = ((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL); 
    33 #else 
    34         box_time_t statusmodified = (((int64_t)st.st_ctimespec.tv_nsec) / NANO_SEC_IN_USEC_LL) 
    35                         + (((int64_t)st.st_ctimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); 
     31        box_time_t statusmodified = 
     32#ifdef HAVE_STRUCT_STAT_ST_MTIMESPEC 
     33                (((int64_t)st.st_ctimespec.tv_nsec) / (NANO_SEC_IN_USEC_LL)) + 
     34                (((int64_t)st.st_ctimespec.tv_sec)  * (MICRO_SEC_IN_SEC_LL)); 
     35#elif defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 
     36                (((int64_t)st.st_ctim.tv_nsec) / (NANO_SEC_IN_USEC_LL)) + 
     37                (((int64_t)st.st_ctim.tv_sec)  * (MICRO_SEC_IN_SEC_LL)); 
     38#elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC 
     39                (((int64_t)st.st_ctimensec) / (NANO_SEC_IN_USEC_LL)) + 
     40                (((int64_t)st.st_ctime)     * (MICRO_SEC_IN_SEC_LL)); 
     41#else // no nanoseconds anywhere 
     42                (((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL)); 
    3643#endif 
    3744