mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
update msleep in deprecated-hid-flasher
This commit is contained in:
parent
1ebfa897c8
commit
2382ad551b
1 changed files with 11 additions and 12 deletions
|
@ -1,10 +1,4 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
|
|
||||||
//
|
|
||||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
|
||||||
// the license.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// platform-independant sleep macros
|
// platform-independant sleep macros
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -13,12 +7,17 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define sleep(n) Sleep(1000 * n)
|
|
||||||
#define msleep(n) Sleep(n)
|
#define msleep(n) Sleep(n)
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <time.h>
|
||||||
#define msleep(n) usleep(1000 * n)
|
#include <errno.h>
|
||||||
|
static void nsleep(uint64_t n) {
|
||||||
|
struct timespec timeout;
|
||||||
|
timeout.tv_sec = n / 1000000000;
|
||||||
|
timeout.tv_nsec = n % 1000000000;
|
||||||
|
while (nanosleep(&timeout, &timeout) && errno == EINTR);
|
||||||
|
}
|
||||||
|
#define msleep(n) nsleep(1000000 * (uint64_t)n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue