Skip to content

Commit

Permalink
Use cgtime in compat.h
Browse files Browse the repository at this point in the history
  • Loading branch information
ckolivas committed Apr 21, 2013
1 parent 17ee0eb commit 564fd36
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compat.h
Expand Up @@ -9,6 +9,7 @@
#include <sys/time.h>

#include "miner.h" // for timersub
#include "util.h"

#include <windows.h>

Expand All @@ -18,7 +19,7 @@ static inline int nanosleep(const struct timespec *req, struct timespec *rem)
struct timeval tstart;
DWORD msecs;

gettimeofday(&tstart, NULL);
cgtime(&tstart);
msecs = (req->tv_sec * 1000) + ((999999 + req->tv_nsec) / 1000000);

if (SleepEx(msecs, true) == WAIT_IO_COMPLETION) {
Expand All @@ -31,7 +32,7 @@ static inline int nanosleep(const struct timespec *req, struct timespec *rem)
++tdone.tv_sec;
}

gettimeofday(&tnow, NULL);
cgtime(&tnow);
if (timercmp(&tnow, &tdone, >))
return 0;
timersub(&tdone, &tnow, &tleft);
Expand Down

0 comments on commit 564fd36

Please sign in to comment.