diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-03-05 23:19:55 -0800 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-03-05 23:19:55 -0800 |
commit | 0b3a2ed92d45a78a13b5abce61d87d0d43ce09d8 (patch) | |
tree | 1513d71f6efa9bafcb071b620d416a917511dd00 /libusb/os/poll_windows.h | |
parent | ec01c28e1e892b410bdd1581a2bd4e46cbd03eac (diff) | |
download | libusb-0b3a2ed92d45a78a13b5abce61d87d0d43ce09d8.tar.gz |
core: Switch usbi_transfer to store timeout as timespec
The transfer timeout is structured around time values provided by the
clock_gettime() function. This function uses a timespec structure, but
the usbi_transfer structure was storing its calculated timeout in a
timeval structure. This mismatch introduces extra work when checking for
transfer timeouts as there must be a conversion between these two
structures. Eliminate this by storing the calculated timeout as a
timespec, thus allowing direct comparison.
Note that a conversion to a timeval is still necessary in the
libusb_get_next_timeout() function because the public API uses a timeval
structure, but this is now the only place where such a conversion is
done.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/os/poll_windows.h')
-rw-r--r-- | libusb/os/poll_windows.h | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/libusb/os/poll_windows.h b/libusb/os/poll_windows.h index a38e1da..df1781b 100644 --- a/libusb/os/poll_windows.h +++ b/libusb/os/poll_windows.h @@ -57,19 +57,4 @@ ssize_t usbi_write(int fd, const void *buf, size_t count); ssize_t usbi_read(int fd, void *buf, size_t count); int usbi_close(int fd); -/* - * Timeval operations - */ -#if !defined(timersub) -#define timersub(a, b, result) \ - do { \ - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ - if ((result)->tv_usec < 0L) { \ - --(result)->tv_sec; \ - (result)->tv_usec += 1000000L; \ - } \ - } while (0) -#endif - #endif |