Skip to content

Commit

Permalink
Sleep method was miscalculating nsecs
Browse files Browse the repository at this point in the history
  • Loading branch information
hintjens committed Feb 24, 2011
1 parent 9f7e451 commit 5960857
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/C/zhelpers.h
Expand Up @@ -180,9 +180,10 @@ s_sleep (int msecs)
Sleep (msecs);
#else
struct timespec t;
t.tv_sec = msecs / 1000;
t.tv_nsec = msecs * 1000000;
nanosleep (&t, NULL);
t.tv_sec = msecs / 1000;
t.tv_nsec = (msecs % 1000) * 1000000;
int rc = nanosleep (&t, NULL);
assert (rc == 0);
#endif
}

Expand Down

0 comments on commit 5960857

Please sign in to comment.