hotspot/src/os/bsd/vm/os_bsd.cpp
changeset 37465 1d5551f466ee
parent 37430 fd743dadef12
child 38290 6b194cfc1557
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Mon Apr 11 09:45:03 2016 +0200
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Mon Apr 11 12:22:09 2016 +0200
@@ -3732,6 +3732,28 @@
   return ::stat(pathbuf, sbuf);
 }
 
+static inline struct timespec get_mtime(const char* filename) {
+  struct stat st;
+  int ret = os::stat(filename, &st);
+  assert(ret == 0, "failed to stat() file '%s': %s", filename, strerror(errno));
+#ifdef __APPLE__
+  return st.st_mtimespec;
+#else
+  return st.st_mtim;
+#endif
+}
+
+int os::compare_file_modified_times(const char* file1, const char* file2) {
+  struct timespec filetime1 = get_mtime(file1);
+  struct timespec filetime2 = get_mtime(file2);
+  int diff = filetime1.tv_sec - filetime2.tv_sec;
+  if (diff == 0) {
+    return filetime1.tv_nsec - filetime2.tv_nsec;
+  }
+  return diff;
+}
+
+
 bool os::check_heap(bool force) {
   return true;
 }