X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/19d9a7b0cecac479befe6a381ab390eed3ed51cd..759c16b31f8dcec37458dd6a5973ce0cfce58015:/client/sleep.c diff --git a/client/sleep.c b/client/sleep.c new file mode 100644 index 00000000..fe397da9 --- /dev/null +++ b/client/sleep.c @@ -0,0 +1,28 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2010 iZsh +// +// 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 +//----------------------------------------------------------------------------- + +#ifndef _WIN32 + +#define _POSIX_C_SOURCE 199309L +#include "sleep.h" +#include +#include +#include +#include + +void nsleep(uint64_t n) { + struct timespec timeout; + timeout.tv_sec = n/1000000000; + timeout.tv_nsec = n%1000000000; + while (nanosleep(&timeout, &timeout) && errno == EINTR); +} + +#endif // _WIN32 +