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.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/libusb/os/windows_compat.h b/libusb/os/windows_compat.h
index 689b82a..8cae332 100644
--- a/libusb/os/windows_compat.h
+++ b/libusb/os/windows_compat.h
@@ -78,6 +78,31 @@ 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
+
+/*
+ * Structure used in select() call, taken from the BSD file sys/time.h.
+ */
+#if defined(DDKBUILD)
+struct timeval {
+ long tv_sec; /* seconds */
+ long tv_usec; /* and microseconds */
+};
+#endif
+
+#if !defined(timerisset)
+#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+#endif
+
+#if !defined(timercmp)
+#define timercmp(tvp, uvp, cmp) \
+ ((tvp)->tv_sec cmp (uvp)->tv_sec || \
+ (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
+#endif
+
+#if !defined(timerclr)
+#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
+#endif
+
#if !defined(TIMESPEC_TO_TIMEVAL)
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
(tv)->tv_sec = (long)(ts)->tv_sec; \