]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test/unit: include microseconds in default random seed
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 15 Feb 2016 15:05:43 +0000 (16:05 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 16 Feb 2016 12:43:28 +0000 (13:43 +0100)
test/unit/test.c

index 7709cb764666f0d765286b27582bccab5b736102..d8d20d169413be0ac7dcb82ab7e2ab7bd87d89d0 100644 (file)
@@ -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);