Skip to content

Commit

Permalink
fix: undeclared usleep function error
Browse files Browse the repository at this point in the history
This commit fixes an issue where "usleep" function wouldn't be used and nanosleep wouldn't be used in newer systems.
  • Loading branch information
ThePedroo committed Jun 4, 2024
1 parent a0212d8 commit 483e0fb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ void frequenc_sleep(int ms) {
Sleep(ms);
#else
#if _POSIX_C_SOURCE >= 199309L
struct timespec ts;
ts.tv_sec = ms / 1000;
ts.tv_nsec = (ms % 1000) * 1000000;
struct timespec ts = {
.tv_sec = ms / 1000,
.tv_nsec = (ms % 1000) * 1000000
};

nanosleep(&ts, NULL);
#else
Expand Down

0 comments on commit 483e0fb

Please sign in to comment.