commit - 39a089ac0ae7a9974bf6174d08636de0872801f4
commit + de1dbfe9d859807c79840ee4720ca95641cbfdb0
blob - 78da94b5a6a66a86e58077352388589e6c6a18f2
blob + c07416a808a6799841c0c9978d004659680beda2
--- include/got_compat.h
+++ include/got_compat.h
#endif
#endif
+/* Check for some of the non-portable timespec*() functions.
+ * This should largely come from libbsd for systems which
+ * aren't BSD, but this will depend on how old the library
+ * is.
+ */
+#ifndef timespecisset
+#define timespecisset(tsp) \
+ ((tsp)->tv_sec || (tsp)->tv_nsec)
+#endif
+
+#ifndef timespecsub
+#define timespecsub(tsp, usp, vsp) \
+ do { \
+ (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
+ (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
+ if ((vsp)->tv_nsec < 0) { \
+ (vsp)->tv_sec--; \
+ (vsp)->tv_nsec += 1000000000L; \
+ } \
+ } while (0)
+#endif
+
+#ifndef timespeccmp
+#define timespeccmp(tvp, uvp, cmp) \
+(((tvp)->tv_sec == (uvp)->tv_sec) ? \
+ ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
+ ((tvp)->tv_sec cmp (uvp)->tv_sec))
+#endif
+
#ifndef HAVE_BSD_MERGESORT
/* mergesort.c */
int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
blob - 219e7905e4765ae964a3ab7a1e8145d1ce344c2f
blob + bebba105c6a81b120e96533ec5705154f663f481
--- lib/ratelimit.c
+++ lib/ratelimit.c
#include "got_lib_ratelimit.h"
+#include "got_compat.h"
#include "got_error.h"
void