changeset 5782:2e6a977b1d6a HEAD

Added CMP_ST_MTIME() and CMP_ST_CTIME() macros that compare also nanoseconds if they're available.
author Timo Sirainen <tss@iki.fi>
date Wed, 20 Jun 2007 01:07:30 +0300
parents 67cc6420c4e6
children 92bc0a7580f6
files src/lib/compat.h
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/compat.h	Tue Jun 19 18:39:16 2007 +0300
+++ b/src/lib/compat.h	Wed Jun 20 01:07:30 2007 +0300
@@ -63,6 +63,18 @@
 #  error I do not know how to compare dev_t
 #endif
 
+#ifdef HAVE_STAT_TV_NSEC
+#  define CMP_ST_MTIME(st1, st2) \
+	((st1)->st_mtime == (st2)->st_mtime && \
+	 (st1)->st_mtim.tv_nsec == (st2)->st_mtim.tv_nsec)
+#  define CMP_ST_CTIME(st1, st2) \
+	((st1)->st_ctime == (st2)->st_ctime && \
+	 (st1)->st_ctim.tv_nsec == (st2)->st_ctim.tv_nsec)
+#else
+#  define CMP_ST_MTIME(st1, st2) ((st1)->st_mtime == (st2)->st_mtime)
+#  define CMP_ST_CTIME(st1, st2) ((st1)->st_ctime == (st2)->st_ctime)
+#endif
+
 /* strcasecmp(), strncasecmp() */
 #ifndef HAVE_STRCASECMP
 #  ifdef HAVE_STRICMP