Taking a peek inside the wget 1.9.1 source reveals the following construction used a number of times in src/retr.c:
usleep(1000000L * opt.wait); There are a couple of problems with this approach. First, we have from the NetBSD man-page of usleep(3): The microseconds argument must be less than 1,000,000. This renders the sleep impossible for other values of opt.wait than 1. NetBSD correctly returns -1 and sets errno to ENVAL. Then there is the problem of the value wrapping around, but that is not the worst thing here. May I suggest using sleep(3) instead. It is used in the code in other places and has the semantics you want. The NetBSD pkgsrc will soon run with the following patch (hopefully) which again makes us able to wait in between retrievals: --- src/retr.c.orig 2003-10-11 15:57:11.000000000 +0200 +++ src/retr.c @@ -642,7 +642,7 @@ sleep_between_retrievals (int count) if (count <= opt.waitretry) sleep (count - 1); else - usleep (1000000L * opt.waitretry); + sleep (opt.waitretry); } else if (opt.wait) { @@ -650,7 +650,7 @@ sleep_between_retrievals (int count) /* If random-wait is not specified, or if we are sleeping between retries of the same download, sleep the fixed interval. */ - usleep (1000000L * opt.wait); + sleep (opt.wait); else { /* Sleep a random amount of time averaging in opt.wait @@ -659,7 +659,7 @@ sleep_between_retrievals (int count) double waitsecs = 2 * opt.wait * random_float (); DEBUGP (("sleep_between_retrievals: avg=%f,sleep=%f\n", opt.wait, waitsecs)); - usleep (1000000L * waitsecs); + sleep (waitsecs); } } } -- j.