summaryrefslogtreecommitdiff
path: root/libusb/os/windows_compat.h
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-01-21 02:55:30 +0000
committerPete Batard <pbatard@gmail.com>2010-01-21 02:55:30 +0000
commit3fa6b35e7e89f48749bf0d05d4d03e7ffe51f431 (patch)
tree7ae3a5fc5837ddefa54193408f0740a117fb19a5 /libusb/os/windows_compat.h
parent0c568de2e355ade7ba1965437e9dc9d6459eed5c (diff)
downloadlibusb-3fa6b35e7e89f48749bf0d05d4d03e7ffe51f431.tar.gz
r96: added sources support (Orin Eman)
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; \