mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-23 03:17:23 +00:00
Add sleep and usleep macros so all sleeps use nanosleep
This commit is contained in:
parent
73319f68b3
commit
ed339b1c2b
@ -27,7 +27,6 @@
|
||||
#include <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
#include <math.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "hamlib/rig.h"
|
||||
#include "serial.h"
|
||||
|
@ -92,6 +92,20 @@
|
||||
#define CONSTANT_64BIT_FLAG(BIT) (1ull << (BIT))
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#undef sleep
|
||||
#undef usleep
|
||||
#if 1
|
||||
#define usleep(n) \
|
||||
do { \
|
||||
struct timespec t;\
|
||||
t.tv_sec=0;\
|
||||
t.tv_nsec = n*1000ul;\
|
||||
nanosleep(&t,NULL);\
|
||||
} while(0)
|
||||
#define sleep(n) do { struct timespec t;t.tv_sec=0;t.tv_nsec = n*1000000000ul;nanosleep(&t,NULL);} while(0)
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern HAMLIB_EXPORT_VAR(const char) hamlib_version[];
|
||||
|
@ -35,8 +35,6 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
/*
|
||||
* Compile only if libusb is available
|
||||
*/
|
||||
@ -46,10 +44,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h> /* Standard input/output definitions */
|
||||
#include <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
#ifdef HAVE_LIBUSB_H
|
||||
# include <libusb.h>
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user