From 64ea8829af8719c0dc1eb7c0d2c9933a7b3d6e04 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 28 Mar 2013 00:00:13 +0000 Subject: Add define for timersub to compat.h. --- compat.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'compat.h') diff --git a/compat.h b/compat.h index b9ee7ba1..622006e1 100644 --- a/compat.h +++ b/compat.h @@ -152,6 +152,18 @@ typedef uint64_t u_int64_t; } while (0) #endif +#ifndef timersub +#define timersub(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ + if ((vvp)->tv_usec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_usec += 1000000; \ + } \ + } while (0) +#endif + #ifndef TTY_NAME_MAX #define TTY_NAME_MAX 32 #endif -- cgit v1.2.3