Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gernhardt <benji@silverinsanity.com>2009-03-08 23:04:28 +0300
committerJunio C Hamano <gitster@pobox.com>2009-03-09 00:04:41 +0300
commitc567383b1e3205c895b371d42a39fbdf131032ba (patch)
tree4ebd878ee331e14ec5b7a165b53799917af833d6 /git-compat-util.h
parent110c46a909fe27f5b8aff412a78cb821300fb985 (diff)
Create USE_ST_TIMESPEC and turn it on for Darwin
Not all OSes use st_ctim and st_mtim in their struct stat. In particular, it appears that OS X uses st_*timespec instead. So add a Makefile variable and #define called USE_ST_TIMESPEC to switch the USE_NSEC defines to use st_*timespec. This also turns it on by default for OS X (Darwin) machines. Likely this is a sane default for other BSD kernels as well, but I don't have any to test that assumption on. Signed-off-by: Brian Gernhardt <benji@silverinsanity.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 9b495dcad8..c915752a24 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -389,8 +389,13 @@ void git_qsort(void *base, size_t nmemb, size_t size,
#define ST_CTIME_NSEC(st) 0
#define ST_MTIME_NSEC(st) 0
#else
+#ifdef USE_ST_TIMESPEC
+#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctimespec.tv_nsec))
+#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtimespec.tv_nsec))
+#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
#endif