You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
984 B

  1. --- a/common/common.h
  2. +++ b/common/common.h
  3. @@ -25,15 +25,13 @@
  4. #ifdef _WINDOWS
  5. #include <fstream> // NOLINT(readability/streams)
  6. #endif
  7. +#include <chrono>
  8. #include <string>
  9. +#include <thread>
  10. #include "common/Strings.h"
  11. inline void msleep( const int msec) {
  12. -#ifdef _WINDOWS
  13. - Sleep(msec);
  14. -#else
  15. - usleep(msec*1000);
  16. -#endif
  17. + std::this_thread::sleep_for(std::chrono::milliseconds(msec));
  18. }
  19. inline void dlog(const char *fmt, ...) {
  20. --- a/service/TellStick_libftdi.cpp
  21. +++ b/service/TellStick_libftdi.cpp
  22. @@ -8,7 +8,6 @@
  23. #include <string.h>
  24. #include <stdlib.h>
  25. #include <stdio.h>
  26. -#include <unistd.h>
  27. #include <list>
  28. #include <string>
  29. @@ -231,7 +230,7 @@ int TellStick::send( const std::string &
  30. return TELLSTICK_SUCCESS;
  31. }
  32. } else if(ret == 0) { // No data available
  33. - usleep(100);
  34. + std::this_thread::sleep_for(std::chrono::microseconds(100));
  35. } else { // Error
  36. Log::debug("Broken pipe on read");
  37. return TELLSTICK_ERROR_BROKEN_PIPE;