Switched usleep to nanosleep for posix complience

This commit is contained in:
Jack Reacher 2016-02-06 02:16:01 -05:00
commit 554d66c768
35 changed files with 70 additions and 47 deletions

19
hydra-time.c Normal file
View file

@ -0,0 +1,19 @@
#include <time.h>
#include "hydra.h"
int sleepn(time_t seconds)
{
struct timespec ts;
ts.tv_sec = seconds;
ts.tv_nsec = 0;
return nanosleep(&ts, NULL);
}
int usleepn(long int milisec) {
struct timespec ts;
ts.tv_sec = milisec / 1000;
ts.tv_nsec = (milisec % 1000) * 1000000L;
return nanosleep(&ts, NULL);
}