]> granicus.if.org Git - sudo/commitdiff
Add timercmp macro for systems without it
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 22 Apr 2010 14:37:20 +0000 (10:37 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 22 Apr 2010 14:37:20 +0000 (10:37 -0400)
include/compat.h

index 3e332ca52a4cebbcfaad364df29d5382df9eb868..1872728aa0e9ca1ceddad7d8c63af50d1424df6b 100644 (file)
@@ -280,6 +280,12 @@ void setprogname(const char *);
        }                                                                      \
     } while (0)
 #endif
+#ifndef timercmp
+#define timercmp(tv1, tv2, cmp)                                                       \
+    (((tv1)->tv_sec == (tv2)->tv_sec) ?                                               \
+       ((tv1)->tv_usec cmp (tv2)->tv_usec) :                                  \
+       ((tv1)->tv_sec cmp (tv2)->tv_sec))
+#endif
 
 #ifndef WCOREDUMP
 # define WCOREDUMP(x)  ((x) & 0x80)