summaryrefslogtreecommitdiff
path: root/src/randsleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/randsleep.c')
-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);