aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-11-29 12:40:25 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-11-29 12:40:25 +0100
commit6a55b4e403979ba299261816a7ec1bb55bbf3f2b (patch)
treed8eba6a7c1483c33547549b07081e9549baa094c /miscutils
parentb86a9ed699e2c4693167d6ead00ac307bd9c01c6 (diff)
downloadbusybox-6a55b4e403979ba299261816a7ec1bb55bbf3f2b.tar.gz
libbb: introduce and use msleep()
function old new delta msleep - 45 +45 watchdog_main 271 266 -5 common_traceroute_main 3546 3530 -16 beep_main 277 248 -29 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/3 up/down: 45/-50) Total: -5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/beep.c4
-rw-r--r--miscutils/watchdog.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/miscutils/beep.c b/miscutils/beep.c
index 1669332fd..7c60aed08 100644
--- a/miscutils/beep.c
+++ b/miscutils/beep.c
@@ -114,10 +114,10 @@ int beep_main(int argc, char **argv)
while (rep) {
//bb_error_msg("rep[%d] freq=%d, length=%d, delay=%d", rep, freq, length, delay);
xioctl(speaker, KIOCSOUND, (void*)(uintptr_t)tickrate_div_freq);
- usleep(1000 * length);
+ msleep(length);
ioctl(speaker, KIOCSOUND, (void*)0);
if (--rep)
- usleep(1000 * delay);
+ msleep(delay);
}
}
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index 8c8d7217f..971b777a3 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -143,7 +143,7 @@ int watchdog_main(int argc UNUSED_PARAM, char **argv)
* as the counter value is undefined at this point -- PFM
*/
write(3, "", 1); /* write zero byte */
- usleep(stimer_duration * 1000L);
+ msleep(stimer_duration);
}
return EXIT_SUCCESS; /* - not reached, but gcc 4.2.1 is too dumb! */
}