mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-15 09:43:00 -07:00
compatibility fix: get_clocktime() is not a available with older glibc
This commit is contained in:
parent
bedae7768c
commit
687ee7236e
1 changed files with 8 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
@ -144,7 +145,14 @@ static void storeCommand(UsbCommand *command) {
|
||||||
static int getCommand(UsbCommand* response, uint32_t ms_timeout) {
|
static int getCommand(UsbCommand* response, uint32_t ms_timeout) {
|
||||||
|
|
||||||
struct timespec end_time;
|
struct timespec end_time;
|
||||||
|
#if (_POSIX_TIMERS > 0)
|
||||||
clock_gettime(CLOCK_REALTIME, &end_time);
|
clock_gettime(CLOCK_REALTIME, &end_time);
|
||||||
|
#else
|
||||||
|
struct timeval tv;
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
end_time.tv_sec = tv.tv_sec;
|
||||||
|
end_time.tv_nsec = tv.tv_usec * 1000;
|
||||||
|
#endif
|
||||||
end_time.tv_sec += ms_timeout / 1000;
|
end_time.tv_sec += ms_timeout / 1000;
|
||||||
end_time.tv_nsec += (ms_timeout % 1000) * 1000000;
|
end_time.tv_nsec += (ms_timeout % 1000) * 1000000;
|
||||||
if (end_time.tv_nsec > 1000000000) {
|
if (end_time.tv_nsec > 1000000000) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue