summaryrefslogtreecommitdiff
path: root/libusb/os/windows_compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'libusb/os/windows_compat.h')
-rw-r--r--libusb/os/windows_compat.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libusb/os/windows_compat.h b/libusb/os/windows_compat.h
index 9159b4e..4eeb6e9 100644
--- a/libusb/os/windows_compat.h
+++ b/libusb/os/windows_compat.h
@@ -76,10 +76,11 @@ struct winfd fd_to_winfd(int fd);
struct winfd handle_to_winfd(HANDLE handle);
struct winfd overlapped_to_winfd(OVERLAPPED* overlapped);
+// On Windows, timeval (defined in WinSock.h) uses long for its members
#if !defined(TIMESPEC_TO_TIMEVAL)
-#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
-(tv)->tv_sec = (ts)->tv_sec; \
-(tv)->tv_usec = (ts)->tv_nsec / 1000; \
+#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)