summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/bb_do_delay.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libbb/bb_do_delay.c b/libbb/bb_do_delay.c
index 3d52cc5..139dc18 100644
--- a/libbb/bb_do_delay.c
+++ b/libbb/bb_do_delay.c
@@ -13,10 +13,9 @@ void FAST_FUNC bb_do_delay(int seconds)
{
time_t start, now;
- time(&start);
- now = start;
- while (difftime(now, start) < seconds) {
+ start = time(NULL);
+ do {
sleep(seconds);
- time(&now);
- }
+ now = time(NULL);
+ } while ((now - start) < seconds);
}