From: Miroslav Lichvar Date: Mon, 15 Feb 2016 15:05:43 +0000 (+0100) Subject: test/unit: include microseconds in default random seed X-Git-Tag: 2.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b6b097fe8b26d3992bf20e2949618a082854504;p=thirdparty%2Fchrony.git test/unit: include microseconds in default random seed --- diff --git a/test/unit/test.c b/test/unit/test.c index 7709cb76..d8d20d16 100644 --- a/test/unit/test.c +++ b/test/unit/test.c @@ -37,6 +37,7 @@ main(int argc, char **argv) { char *test_name, *s; int i, seed = 0; + struct timeval tv; test_name = argv[0]; s = strrchr(test_name, '.'); @@ -57,7 +58,8 @@ main(int argc, char **argv) } } - srandom(seed ? seed : time(NULL)); + gettimeofday(&tv, NULL); + srandom(seed ? seed : tv.tv_sec ^ (tv.tv_usec << 10)); printf("Testing %-30s ", test_name); fflush(stdout);