windows-add-clock-gettime-check.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From 5691f303ad272a2514f68a96d6c18aeff62eb33d Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <[email protected]>
  3. Date: Sun, 12 Jun 2022 22:22:39 -0700
  4. Subject: [PATCH] windows: Add clock_gettime check
  5. Under MSYS2, the windows usbi_get_monotonic_time interferes with the
  6. static inline function under libusbi.h
  7. Closes #1151
  8. ---
  9. libusb/os/windows_common.c | 2 ++
  10. libusb/version_nano.h | 2 +-
  11. 2 files changed, 3 insertions(+), 1 deletion(-)
  12. diff --git a/libusb/os/windows_common.c b/libusb/os/windows_common.c
  13. index 24ac095c..1f4b6835 100644
  14. --- a/libusb/os/windows_common.c
  15. +++ b/libusb/os/windows_common.c
  16. @@ -848,6 +848,7 @@ static int windows_handle_transfer_completion(struct usbi_transfer *itransfer)
  17. return usbi_handle_transfer_completion(itransfer, status);
  18. }
  19. +#ifndef HAVE_CLOCK_GETTIME
  20. void usbi_get_monotonic_time(struct timespec *tp)
  21. {
  22. static LONG hires_counter_init;
  23. @@ -872,6 +873,7 @@ void usbi_get_monotonic_time(struct timespec *tp)
  24. tp->tv_sec = (long)(hires_counter.QuadPart / hires_frequency);
  25. tp->tv_nsec = (long)(((hires_counter.QuadPart % hires_frequency) * hires_ticks_to_ps) / UINT64_C(1000));
  26. }
  27. +#endif
  28. // NB: MSVC6 does not support named initializers.
  29. const struct usbi_os_backend usbi_backend = {
  30. # diff --git a/libusb/version_nano.h b/libusb/version_nano.h
  31. # index 045fb83c..35ee140b 100644
  32. # --- a/libusb/version_nano.h
  33. # +++ b/libusb/version_nano.h
  34. # @@ -1 +1 @@
  35. # -#define LIBUSB_NANO 11730
  36. # +#define LIBUSB_NANO 11731
  37. # --
  38. # 2.50.1