3
0

bb_do_delay.c 479 B

12345678910111213141516171819202122232425262728293031
  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. *
  7. * Licensed under the GPL v2, see the file LICENSE in this tarball.
  8. */
  9. #include <time.h>
  10. #include <unistd.h>
  11. void bb_do_delay(int seconds)
  12. {
  13. time_t start, now;
  14. time(&start);
  15. now = start;
  16. while (difftime(now, start) < seconds) {
  17. sleep(seconds);
  18. time(&now);
  19. }
  20. }
  21. /*
  22. Local Variables:
  23. c-file-style: "linux"
  24. c-basic-offset: 4
  25. tab-width: 4
  26. End:
  27. */