summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-04-09 22:14:51 +0000
committerChris Wilson <chris+github@qwirx.com>2014-04-09 22:14:51 +0000
commit27b4fa3327d347058c586f149856e36085cc934c (patch)
tree80ac7f8197bdefce0320f3d18949144650b03ba8 /lib
parent8f7ccfa9502a4ebb9b92cf6f78f11f6f6dbe660b (diff)
Support microsecond timestamps for files on Linux.
Diffstat (limited to 'lib')
-rw-r--r--lib/common/FileModificationTime.cpp14
1 files changed, 10 insertions, 4 deletions
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