Skip to content

Instantly share code, notes, and snippets.

@27Cobalter
Last active March 25, 2025 11:58
Show Gist options
  • Save 27Cobalter/3daebcae4f8af0cc5282fb010415d044 to your computer and use it in GitHub Desktop.
Save 27Cobalter/3daebcae4f8af0cc5282fb010415d044 to your computer and use it in GitHub Desktop.
$ vcpkg install libusb pthread
$ # set PKG_CONFIG_PATH=%VCPKG_ROOT%\installed\%VCPKG_DEFAULT_HOST_TRIPLET%\lib\pkgconfig
$ cmake -S. -Bbuild -DPKG_CONFIG_EXECUTABLE=C:\Local\src\Vcpkg\downloads\tools\msys2\d33df895d441a36d\mingw64\bin\pkg-config.exe

https://en.eeworld.com.cn/mp/EmbeddedLee/a379948.jspx

diff --git a/cmake/FindLibUSB.cmake b/cmake/FindLibUSB.cmake
index 43f3201..0097254 100644
--- a/cmake/FindLibUSB.cmake
+++ b/cmake/FindLibUSB.cmake
@@ -9,10 +9,6 @@ target LibUSB::LibUSB
 
 # TODO Append parts for Version compasion and REQUIRED support
 
-if (MSVC OR MINGW)
-    return()
-endif()
-
 if (NOT TARGET LibUSB::LibUSB)
   find_package(PkgConfig)
   pkg_check_modules(LibUSB REQUIRED
diff --git a/include/libuvc/libuvc.h b/include/libuvc/libuvc.h
index d387150..6ed6d50 100644
--- a/include/libuvc/libuvc.h
+++ b/include/libuvc/libuvc.h
@@ -7,7 +7,8 @@ extern "C" {
 
 #include <stdio.h> // FILE
 #include <stdint.h>
-#include <sys/time.h>
+#include <time.h>
+#include <winsock.h>
 #include <libuvc/libuvc_config.h>
 
 struct libusb_context;
diff --git a/src/stream.c b/src/stream.c
index 89dac69..ef2969d 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -659,7 +659,8 @@ void _uvc_swap_buffers(uvc_stream_handle_t *strmh) {
 
   pthread_mutex_lock(&strmh->cb_mutex);
 
-  (void)clock_gettime(CLOCK_MONOTONIC, &strmh->capture_time_finished);
+  // (void)clock_gettime(CLOCK_MONOTONIC, &strmh->capture_time_finished);
+  timespec_get(&strmh->capture_time_finished, TIME_UTC);
 
   /* swap the buffers */
   tmp_buf = strmh->holdbuf;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment