X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fdropin.h;h=5279de79f4f1477f3933db39d483977cfec5e306;hb=b811e980e3a2a301c019459b91df2252468fd572;hp=3617b70e2b172083c83df9bf44213db3b2560a90;hpb=f5dc136cfd7a3a195b75f7174722734e25f30fd9;p=tinc diff --git a/src/dropin.h b/src/dropin.h index 3617b70e..5279de79 100644 --- a/src/dropin.h +++ b/src/dropin.h @@ -45,4 +45,22 @@ extern int gettimeofday(struct timeval *, void *); extern int usleep(long long usec); #endif -#endif /* __DROPIN_H__ */ +#ifndef timeradd +#define timeradd(a, b, r) do {\ + (r)->tv_sec = (a)->tv_sec + (b)->tv_sec;\ + (r)->tv_usec = (a)->tv_usec + (b)->tv_usec;\ + if((r)->tv_usec >= 1000000)\ + (r)->tv_sec++, (r)->tv_usec -= 1000000;\ +} while (0) +#endif + +#ifndef timersub +#define timersub(a, b, r) do {\ + (r)->tv_sec = (a)->tv_sec - (b)->tv_sec;\ + (r)->tv_usec = (a)->tv_usec - (b)->tv_usec;\ + if((r)->tv_usec < 0)\ + (r)->tv_sec--, (r)->tv_usec += 1000000;\ +} while (0) +#endif + +#endif /* __DROPIN_H__ */