diff --git a/Makefile.am b/Makefile.am index 2417fbe3..3079f6d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,7 +24,7 @@ bin_SCRIPTS = $(top_srcdir)/*.cl cgminer_LDFLAGS = $(PTHREAD_FLAGS) cgminer_LDADD = $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \ @OPENCL_LIBS@ @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ \ - @UDEV_LIBS@ @LIBUSB_LIBS@ \ + @UDEV_LIBS@ @LIBUSB_LIBS@ @MM_LIBS@ \ @MATH_LIBS@ lib/libgnu.a ccan/libccan.a if HAVE_WINDOWS diff --git a/configure.ac b/configure.ac index 6c2b3c40..4fb74a19 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ PTHREAD_FLAGS="-lpthread" DLOPEN_FLAGS="-ldl" OPENCL_LIBS="-lOpenCL" WS2_LIBS="" +MM_LIBS="" MATH_LIBS="-lm" case $target in @@ -85,6 +86,7 @@ case $target in PTHREAD_FLAGS="" DLOPEN_FLAGS="" WS2_LIBS="-lws2_32" + MM_LIBS="-lwinmm" AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support") ;; powerpc-*-darwin*) @@ -493,6 +495,7 @@ AC_SUBST(PTHREAD_LIBS) AC_SUBST(NCURSES_LIBS) AC_SUBST(PDCURSES_LIBS) AC_SUBST(WS2_LIBS) +AC_SUBST(MM_LIBS) AC_SUBST(MATH_LIBS) AC_SUBST(UDEV_LIBS) AC_SUBST(YASM_FMT) diff --git a/util.c b/util.c index ffe4b941..0433d0b1 100644 --- a/util.c +++ b/util.c @@ -30,6 +30,7 @@ # include # include #else +# include # include # include #endif @@ -825,6 +826,9 @@ void nmsleep(unsigned int msecs) int ret; ldiv_t d; +#ifdef WIN32 + timeBeginPeriod(1); +#endif d = ldiv(msecs, 1000); tleft.tv_sec = d.quot; tleft.tv_nsec = d.rem * 1000000; @@ -833,6 +837,9 @@ void nmsleep(unsigned int msecs) twait.tv_nsec = tleft.tv_nsec; ret = nanosleep(&twait, &tleft); } while (ret == -1 && errno == EINTR); +#ifdef WIN32 + timeEndPeriod(1); +#endif } /* Returns the microseconds difference between end and start times as a double */