]> git.zerfleddert.de Git - proxmark3-svn/blame - client/sleep.c
add: added a noncedistance method
[proxmark3-svn] / client / sleep.c
CommitLineData
759c16b3 1//-----------------------------------------------------------------------------
2// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
3//
4// This code is licensed to you under the terms of the GNU GPL, version 2 or,
5// at your option, any later version. See the LICENSE.txt file for the text of
6// the license.
7//-----------------------------------------------------------------------------
8// platform-independant sleep macros
9//-----------------------------------------------------------------------------
10
11#ifndef _WIN32
12
13#define _POSIX_C_SOURCE 199309L
14#include "sleep.h"
15#include <time.h>
16#include <stdio.h>
17#include <sys/time.h>
18#include <errno.h>
19
20void nsleep(uint64_t n) {
21 struct timespec timeout;
22 timeout.tv_sec = n/1000000000;
23 timeout.tv_nsec = n%1000000000;
24 while (nanosleep(&timeout, &timeout) && errno == EINTR);
25}
26
27#endif // _WIN32
28
Impressum, Datenschutz