diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-09-29 13:36:37 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-09-30 05:37:20 -0400 |
commit | 8649dfd8df4f0d840a64c1d6c5fc80b8e94a68d1 (patch) | |
tree | aa36d644e11f54fab6546a58e0705155072e2221 /src | |
parent | 126932eb0b3986784915acb4fab8f4137d162651 (diff) | |
download | libgit2-8649dfd8df4f0d840a64c1d6c5fc80b8e94a68d1.tar.gz |
p_futimes: support using futimens when available
Diffstat (limited to 'src')
-rw-r--r-- | src/unix/posix.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/unix/posix.h b/src/unix/posix.h index 777350990..6633689bc 100644 --- a/src/unix/posix.h +++ b/src/unix/posix.h @@ -22,7 +22,6 @@ typedef int GIT_SOCKET; #define p_stat(p,b) stat(p, b) #define p_utimes(f, t) utimes(f, t) -#define p_futimes(f, t) futimes(f, t) #define p_readlink(a, b, c) readlink(a, b, c) #define p_symlink(o,n) symlink(o, n) @@ -53,4 +52,18 @@ extern char *p_realpath(const char *, char *); #define p_localtime_r(c, r) localtime_r(c, r) #define p_gmtime_r(c, r) gmtime_r(c, r) +#ifdef HAVE_FUTIMENS +GIT_INLINE(int) p_futimes(int f, const struct timeval t[2]) +{ + struct timespec s[2]; + s[0].tv_sec = t[0].tv_sec; + s[0].tv_nsec = t[0].tv_usec * 1000; + s[1].tv_sec = t[1].tv_sec; + s[1].tv_nsec = t[1].tv_usec * 1000; + return futimens(f, s); +} +#else +# define p_futimes futimes +#endif + #endif |