X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/01aa068b6ff34d86dd5d9d9e962aba20cd490050..ebf1404a813867dbfb60dc5f4b13cfee62fb3b71:/client/comms.c diff --git a/client/comms.c b/client/comms.c index dcbd3ada..1391641d 100644 --- a/client/comms.c +++ b/client/comms.c @@ -9,6 +9,8 @@ // Code for communicating with the proxmark3 hardware. //----------------------------------------------------------------------------- +#define _POSIX_C_SOURCE 199309L // need clock_gettime() + #include "comms.h" #include @@ -17,6 +19,7 @@ #include #include #include +#include #include "uart.h" #include "ui.h" @@ -472,7 +475,6 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo #endif uint64_t start_time = msclock(); - uint64_t end_time = start_time + ms_timeout; if (response == NULL) { response = &resp; @@ -480,7 +482,7 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo // Wait until the command is received while (true) { - if (msclock() > end_time) { + if (ms_timeout != -1 && msclock() > start_time + ms_timeout) { break; // timeout } if (msclock() - start_time > 2000 && show_warning) {