]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/comms.c
Merge pull request #926 from pwpiwi/fix_iso15693_fpga
[proxmark3-svn] / client / comms.c
index dcbd3adaecd4d88cafc480dd8aeefba41079293c..1391641d569ce9a3183933378e3983c3268ba657 100644 (file)
@@ -9,6 +9,8 @@
 // Code for communicating with the proxmark3 hardware.
 //-----------------------------------------------------------------------------
 
+#define _POSIX_C_SOURCE 199309L // need clock_gettime()
+
 #include "comms.h"
 
 #include <stdio.h>
@@ -17,6 +19,7 @@
 #include <pthread.h>
 #include <inttypes.h>
 #include <time.h>
+#include <sys/time.h>
 
 #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) {
Impressum, Datenschutz