summaryrefslogtreecommitdiff
path: root/src/unix
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-02-25 11:23:19 -0500
committerEdward Thomson <ethomson@github.com>2016-02-25 11:40:48 -0500
commit3d6a42d1e14281c564d779e7490d761555d014d4 (patch)
tree78c9d746d024cb13afe04283ec8d8564f6275cba /src/unix
parenta4c55069e3481fda0ab6abe82f0c63672eb8b3e9 (diff)
downloadlibgit2-3d6a42d1e14281c564d779e7490d761555d014d4.tar.gz
nsec: support NDK's crazy nanoseconds
Android NDK does not have a `struct timespec` in its `struct stat` for nanosecond support, instead it has a single nanosecond member inside the struct stat itself. We will use that and use a macro to expand to the `st_mtim` / `st_mtimespec` definition on other systems (much like the existing `st_mtime` backcompat definition).
Diffstat (limited to 'src/unix')
-rw-r--r--src/unix/posix.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/unix/posix.h b/src/unix/posix.h
index 83edf2b7e..482d2c803 100644
--- a/src/unix/posix.h
+++ b/src/unix/posix.h
@@ -21,6 +21,18 @@ typedef int GIT_SOCKET;
#define p_lstat(p,b) lstat(p,b)
#define p_stat(p,b) stat(p, b)
+#if defined(GIT_USE_STAT_MTIMESPEC)
+# define st_atime_nsec st_atimespec.tv_nsec
+# define st_mtime_nsec st_mtimespec.tv_nsec
+# define st_ctime_nsec st_ctimespec.tv_nsec
+#elif defined(GIT_USE_STAT_MTIM)
+# define st_atime_nsec st_atim.tv_nsec
+# define st_mtime_nsec st_mtim.tv_nsec
+# define st_ctime_nsec st_ctim.tv_nsec
+#elif !defined(GIT_USE_STAT_MTIME_NSEC) && defined(GIT_USE_NEC)
+# error GIT_USE_NSEC defined but unknown struct stat nanosecond type
+#endif
+
#define p_utimes(f, t) utimes(f, t)
#define p_readlink(a, b, c) readlink(a, b, c)