logswan

Fast Web log analyzer using probabilistic data structures
Log | Files | Refs | README | LICENSE

commit fdb350280c51b19a5683b0d65c89e1a78c2fff35
parent 0c358faad3bab540f19c9ac94cfb00650d63205d
Author: Frederic Cambus <fred@statdns.com>
Date:   Wed, 27 Jun 2018 23:01:02 +0200

Define timespecsub macro in compat.h if it doesn't exists

Diffstat:
Mcompat/compat.h | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/compat/compat.h b/compat/compat.h @@ -5,3 +5,15 @@ #ifndef HAVE_STRTONUM #include "strtonum.h" #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