diff options
author | Vincent Peyruqueou | 2023-03-27 11:12:55 +0200 |
---|---|---|
committer | Vincent Peyruqueou | 2023-03-27 11:12:55 +0200 |
commit | 7c608bc1d5c126df839c699c5ae531828a00caa3 (patch) | |
tree | 4ebfa62a389439d9dc6fac23929714f95e23d3cb /src/timer.h | |
parent | c238c8851fe2f58008a8a290eb66c3531b4fd0b7 (diff) | |
download | ivy-c-7c608bc1d5c126df839c699c5ae531828a00caa3.zip ivy-c-7c608bc1d5c126df839c699c5ae531828a00caa3.tar.gz ivy-c-7c608bc1d5c126df839c699c5ae531828a00caa3.tar.bz2 ivy-c-7c608bc1d5c126df839c699c5ae531828a00caa3.tar.xz |
Microsoft Visual Studio (2022) solution for src (lib IVY)
Diffstat (limited to 'src/timer.h')
-rw-r--r-- | src/timer.h | 15 |
1 files changed, 15 insertions, 0 deletions
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 <sys/time.h> + */ +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 */ |