summaryrefslogtreecommitdiff
path: root/libbb/bb_do_delay.c
diff options
context:
space:
mode:
authorDenys Vlasenko2009-10-27 09:54:34 +0100
committerDenys Vlasenko2009-10-27 09:54:34 +0100
commit12450dbeef1afee5ed27f8f3a2395edbdc7a9355 (patch)
tree4a5d987c12f07e35a46309f03829e6a4370ba19a /libbb/bb_do_delay.c
parent52b971f516efc3acb8c69536c3b7be7b7c3bf1c0 (diff)
downloadbusybox-12450dbeef1afee5ed27f8f3a2395edbdc7a9355.zip
busybox-12450dbeef1afee5ed27f8f3a2395edbdc7a9355.tar.gz
libbb/bb_do_delay.c: shrink
function old new delta difftime 9 - -9 bb_do_delay 88 38 -50 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-59) Total: -59 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/bb_do_delay.c')
-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);
}