aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Hampson <ahampson@google.com>2013-01-28 18:35:11 -0800
committerAdam Hampson <ahampson@google.com>2013-01-29 08:57:31 -0800
commit3dd6b0719cb1b8105377280758190d9def84ff3a (patch)
tree298cbe3ec61b73bdc02c0fa0d00aff5f6c76acd0
parent60ed380e961ed65bf2ddeb16d43121cdbeba6d3e (diff)
downloadlibusb_aah-3dd6b0719cb1b8105377280758190d9def84ff3a.tar.gz
Move TIMESPEC_TO_TIMEVAL definition
Bionic's sys/time.h does not contain this definition so it is needed by both Windows and Android. Change-Id: I9bdbefca939f96528fe9ddb9e6c0d46663421562 Signed-off-by: Adam Hampson <ahampson@google.com>
-rw-r--r--libusb/io.c7
-rw-r--r--libusb/os/poll_windows.h6
2 files changed, 7 insertions, 6 deletions
diff --git a/libusb/io.c b/libusb/io.c
index e9bd312..0b876d1 100644
--- a/libusb/io.c
+++ b/libusb/io.c
@@ -1046,6 +1046,13 @@ printf("completed!\n");
* give up the events lock if instructed.
*/
+#if !defined(TIMESPEC_TO_TIMEVAL)
+#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
+ (tv)->tv_sec = (long)(ts)->tv_sec; \
+ (tv)->tv_usec = (long)(ts)->tv_nsec / 1000; \
+}
+#endif
+
int usbi_io_init(struct libusb_context *ctx)
{
int r;
diff --git a/libusb/os/poll_windows.h b/libusb/os/poll_windows.h
index 6e5bf2b..e66c321 100644
--- a/libusb/os/poll_windows.h
+++ b/libusb/os/poll_windows.h
@@ -95,12 +95,6 @@ struct winfd overlapped_to_winfd(OVERLAPPED* overlapped);
#include <winsock.h> // defines timeval functions on DDK
#endif
-#if !defined(TIMESPEC_TO_TIMEVAL)
-#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
- (tv)->tv_sec = (long)(ts)->tv_sec; \
- (tv)->tv_usec = (long)(ts)->tv_nsec / 1000; \
-}
-#endif
#if !defined(timersub)
#define timersub(a, b, result) \
do { \