Record ns-timestamps if possible, but do not use it without USE_NSEC
[gitweb.git] / git-compat-util.h
index 079cbe9440dc73ba8703fe2efb70bd6677535a05..9b495dcad849cc103c9b03699df8d33b7d871235 100644 (file)
@@ -384,4 +384,13 @@ void git_qsort(void *base, size_t nmemb, size_t size,
 # define FORCE_DIR_SET_GID 0
 #endif
 
+#ifdef NO_NSEC
+#undef USE_NSEC
+#define ST_CTIME_NSEC(st) 0
+#define ST_MTIME_NSEC(st) 0
+#else
+#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctim.tv_nsec))
+#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtim.tv_nsec))
+#endif
+
 #endif