core: Switch usbi_transfer to store timeout as timespec
authorChris Dickens <christopher.a.dickens@gmail.com>
Fri, 6 Mar 2020 07:19:55 +0000 (23:19 -0800)
committerChris Dickens <christopher.a.dickens@gmail.com>
Fri, 6 Mar 2020 07:19:55 +0000 (23:19 -0800)
commit0b3a2ed92d45a78a13b5abce61d87d0d43ce09d8
tree1513d71f6efa9bafcb071b620d416a917511dd00
parentec01c28e1e892b410bdd1581a2bd4e46cbd03eac
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>
libusb/io.c
libusb/libusbi.h
libusb/os/poll_windows.h
libusb/version_nano.h