[Cmake-commits] CMake branch, next, updated. v3.4.0-rc1-220-gb184adf

Brad King brad.king at kitware.com
Thu Oct 8 14:00:53 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  b184adfa4101a0f4636bbfbf82e6c0c147d791e5 (commit)
       via  8d27b407787549a90d47d273a753bb0000e5e73e (commit)
      from  becbfbb1988e1cd8805cf063fda8e9eebc3c34ac (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b184adfa4101a0f4636bbfbf82e6c0c147d791e5
commit b184adfa4101a0f4636bbfbf82e6c0c147d791e5
Merge: becbfbb 8d27b40
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Oct 8 14:00:52 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Oct 8 14:00:52 2015 -0400

    Merge topic 'osx-file-times-ns-precision' into next
    
    8d27b407 cmFileTimeComparison: Port to OS X nanosecond times (#15769)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d27b407787549a90d47d273a753bb0000e5e73e
commit 8d27b407787549a90d47d273a753bb0000e5e73e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Oct 8 13:37:37 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Oct 8 13:37:37 2015 -0400

    cmFileTimeComparison: Port to OS X nanosecond times (#15769)

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 28a3fd1..ee690e6 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -550,6 +550,7 @@ endforeach()
 
 foreach(check
     STAT_HAS_ST_MTIM
+    STAT_HAS_ST_MTIMESPEC
     )
   if(KWSYS_CXX_${check}_COMPILED) # abuse KWSys check cache entry
     set(CMake_${check} 1)
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx
index 8d5e08d..279b61d 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeComparison.cxx
@@ -166,6 +166,24 @@ int cmFileTimeComparisonInternal::Compare(cmFileTimeComparison_Type* s1,
     {
     return 1;
     }
+# elif CMake_STAT_HAS_ST_MTIMESPEC
+  // Compare using nanosecond resolution.
+  if(s1->st_mtimespec.tv_sec < s2->st_mtimespec.tv_sec)
+    {
+    return -1;
+    }
+  else if(s1->st_mtimespec.tv_sec > s2->st_mtimespec.tv_sec)
+    {
+    return 1;
+    }
+  else if(s1->st_mtimespec.tv_nsec < s2->st_mtimespec.tv_nsec)
+    {
+    return -1;
+    }
+  else if(s1->st_mtimespec.tv_nsec > s2->st_mtimespec.tv_nsec)
+    {
+    return 1;
+    }
 # else
   // Compare using 1 second resolution.
   if(s1->st_mtime < s2->st_mtime)
@@ -207,6 +225,23 @@ bool cmFileTimeComparisonInternal::TimesDiffer(cmFileTimeComparison_Type* s1,
     {
     return false;
     }
+# elif CMake_STAT_HAS_ST_MTIMESPEC
+  // Times are integers in units of 1ns.
+  long long bil = 1000000000;
+  long long t1 = s1->st_mtimespec.tv_sec * bil + s1->st_mtimespec.tv_nsec;
+  long long t2 = s2->st_mtimespec.tv_sec * bil + s2->st_mtimespec.tv_nsec;
+  if(t1 < t2)
+    {
+    return (t2 - t1) >= bil;
+    }
+  else if(t2 < t1)
+    {
+    return (t1 - t2) >= bil;
+    }
+  else
+    {
+    return false;
+    }
 # else
   // Times are integers in units of 1s.
   if(s1->st_mtime < s2->st_mtime)

-----------------------------------------------------------------------

Summary of changes:
 Source/CMakeLists.txt           |    1 +
 Source/cmFileTimeComparison.cxx |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list