From 7c608bc1d5c126df839c699c5ae531828a00caa3 Mon Sep 17 00:00:00 2001 From: Vincent Peyruqueou Date: Mon, 27 Mar 2023 11:12:55 +0200 Subject: Microsoft Visual Studio (2022) solution for src (lib IVY) --- src/timer.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/timer.h') diff --git a/src/timer.h b/src/timer.h index accad5b..627bdb2 100644 --- a/src/timer.h +++ b/src/timer.h @@ -44,6 +44,21 @@ struct timezone int tz_dsttime; /* type of dst correction */ }; int gettimeofday(struct timeval *tv, struct timezone *tz); + +/** + * timersub(3) from + */ +static inline void timersub(struct timeval* a, struct timeval* b, + struct timeval* res) +{ + res->tv_sec = a->tv_sec - b->tv_sec; + res->tv_usec = a->tv_usec - b->tv_usec; + if (res->tv_usec < 0) + { + res->tv_usec += 1000000; + res->tv_sec--; + } +} #endif /* Interface avec select */ -- cgit v1.1