Rob Landley | 84cb767 | 2006-01-06 20:59:09 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | ||||
3 | * Busybox utility routines. | ||||
4 | * | ||||
5 | * Copyright (C) 2005 by Tito Ragusa <tito-wolit@tiscali.it> | ||||
6 | * | ||||
Denys Vlasenko | 0ef64bd | 2010-08-16 20:14:46 +0200 | [diff] [blame] | 7 | * Licensed under GPLv2, see file LICENSE in this source tree. |
Rob Landley | 84cb767 | 2006-01-06 20:59:09 +0000 | [diff] [blame] | 8 | */ |
9 | |||||
Bernhard Reutner-Fischer | 421d9e5 | 2006-04-03 16:39:31 +0000 | [diff] [blame] | 10 | #include "libbb.h" |
Rob Landley | 84cb767 | 2006-01-06 20:59:09 +0000 | [diff] [blame] | 11 | |
Denis Vlasenko | defc1ea | 2008-06-27 02:52:20 +0000 | [diff] [blame] | 12 | void FAST_FUNC bb_do_delay(int seconds) |
Rob Landley | 84cb767 | 2006-01-06 20:59:09 +0000 | [diff] [blame] | 13 | { |
14 | time_t start, now; | ||||
15 | |||||
Denys Vlasenko | 12450db | 2009-10-27 09:54:34 +0100 | [diff] [blame] | 16 | start = time(NULL); |
17 | do { | ||||
Rob Landley | 84cb767 | 2006-01-06 20:59:09 +0000 | [diff] [blame] | 18 | sleep(seconds); |
Denys Vlasenko | 12450db | 2009-10-27 09:54:34 +0100 | [diff] [blame] | 19 | now = time(NULL); |
20 | } while ((now - start) < seconds); | ||||
Rob Landley | 84cb767 | 2006-01-06 20:59:09 +0000 | [diff] [blame] | 21 | } |