Skip to content

Commit

Permalink
platform: remove obsolete usleep function
Browse files Browse the repository at this point in the history
  • Loading branch information
joelguittet committed Nov 22, 2023
1 parent dffb19a commit e078218
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion platform/rtos/posix/src/mender-rtos.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,14 @@ mender_rtos_delay_until_s(unsigned long *handle, uint32_t delay) {
unsigned long delay_us = delay * 1000000;
unsigned long real_delay_us = (unsigned long)ceil((double)(delay_us - elapsed));
if ((0 < real_delay_us) && (real_delay_us <= delay_us)) {
usleep((useconds_t)real_delay_us);
struct timespec request;
struct timespec remaining;
remaining.tv_sec = real_delay_us / 1000000;
remaining.tv_nsec = (real_delay_us % 1000000) * 1000;
do {
request.tv_sec = remaining.tv_sec;
request.tv_nsec = remaining.tv_nsec;
} while (nanosleep(&request, &remaining) < 0);
}

/* Read clock */
Expand Down

0 comments on commit e078218

Please sign in to comment.