Skip to content

Instantly share code, notes, and snippets.

@rlonstein
Created May 6, 2015 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlonstein/bb24b8d6e668f39ec63c to your computer and use it in GitHub Desktop.
Save rlonstein/bb24b8d6e668f39ec63c to your computer and use it in GitHub Desktop.
diff --git a/src/libusb/funcs.d b/src/libusb/funcs.d
index 9e8e335..af47f42 100644
--- a/src/libusb/funcs.d
+++ b/src/libusb/funcs.d
@@ -20,7 +20,16 @@ import consts;
import enums;
import structs;
import core.stdc.limits : INT_MAX;
-import core.sys.posix.sys.time : timeval;
+
+version( Windows ) {
+ import core.sys.windows.winsock2.d : timeval;
+}
+else version( Posix ) {
+ import core.sys.posix.sys.time : timeval;
+}
+else {
+ static assert(false, "Unsupported platform");
+}
extern (C):
diff --git a/src/libusb/package.d b/src/libusb/package.d
index f1afb52..8b59fe8 100644
--- a/src/libusb/package.d
+++ b/src/libusb/package.d
@@ -41,7 +41,5 @@ public {
import funcs;
}
-import core.sys.posix.sys.time : timeval;
-
/* Total number of error codes in enum libusb_error */
const LIBUSB_ERROR_COUNT = EnumMembers!libusb_error.length;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment