summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/randsleep.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/randsleep.c b/src/randsleep.c
index 46c6353..bf7bdc3 100644
--- a/src/randsleep.c
+++ b/src/randsleep.c
@@ -5,19 +5,15 @@
int main (int argc, char **argv) {
long maxsleep;
- struct timespec ntime;
if (argc < 2) {
- fputs("Usage: randsleep <max> [<cmd>]\n", stdout);
+ fputs("Usage: randsleep <max> [<cmd> [<args ...>]]\n", stderr);
return 1;
}
maxsleep = atol(argv[1]);
- if (clock_gettime(CLOCK_REALTIME, &ntime) == -1)
- perror("clock_gettime");
-
- srand(ntime.tv_nsec);
+ srand(time(NULL) + getpid());
sleep((rand() % maxsleep) + 1);