Merge pull request #3604 from ethomson/nsec_xplat Handle `USE_NSECS`
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
diff --git a/src/common.h b/src/common.h
index 2913baa..bc4bdd8 100644
--- a/src/common.h
+++ b/src/common.h
@@ -62,6 +62,12 @@
# endif
#define GIT_STDLIB_CALL
+#ifdef GIT_USE_STAT_ATIMESPEC
+# define st_atim st_atimespec
+# define st_ctim st_ctimespec
+# define st_mtim st_mtimespec
+#endif
+
# include <arpa/inet.h>
#endif
diff --git a/src/fileops.c b/src/fileops.c
index 6aafd06..150333d 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -13,12 +13,6 @@
#include "win32/findfile.h"
#endif
-#ifdef GIT_USE_STAT_ATIMESPEC
-#define st_atim st_atimespec
-#define st_ctim st_ctimespec
-#define st_mtim st_mtimespec
-#endif
-
GIT__USE_STRMAP
int git_futils_mkpath2file(const char *file_path, const mode_t mode)
diff --git a/src/index.h b/src/index.h
index a64c645..8b9b494 100644
--- a/src/index.h
+++ b/src/index.h
@@ -92,7 +92,7 @@ GIT_INLINE(bool) git_index_entry_newer_than_index(
/* If the timestamp is the same or newer than the index, it's racy */
#if defined(GIT_USE_NSEC)
- if ((int32_t)index->stamp.tv_sec < entry->mtime.seconds)
+ if ((int32_t)index->stamp.mtime.tv_sec < entry->mtime.seconds)
return true;
else if ((int32_t)index->stamp.mtime.tv_sec > entry->mtime.seconds)
return false;