libbb/bb_do_delay.c: shrink
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 27 Oct 2009 08:54:34 +0000 (09:54 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 27 Oct 2009 08:54:34 +0000 (09:54 +0100)
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>
libbb/bb_do_delay.c

index 3d52cc562aff3cf656c15af46afa28f4f11f10ba..139dc18785a5bcf8d27b68f0dcbc60955cf98b50 100644 (file)
@@ -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);
 }