Replace gettimeofday with clock_gettime (#2159)

This commit is contained in:
carpintero-de-c
2024-07-14 03:55:58 +05:30
committed by GitHub
parent 3f26818d97
commit 7c380a6612
8 changed files with 50 additions and 51 deletions

View File

@ -52,7 +52,6 @@
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/time.h>
static u8 **as_params; /* Parameters passed to the real 'as' */
@ -557,8 +556,7 @@ int main(int argc, char **argv) {
int status;
u8 *inst_ratio_str = getenv("AFL_INST_RATIO");
struct timeval tv;
struct timezone tz;
struct timespec spec;
clang_mode = !!getenv(CLANG_ENV_VAR);
@ -609,9 +607,9 @@ int main(int argc, char **argv) {
}
gettimeofday(&tv, &tz);
clock_gettime(CLOCK_REALTIME, &spec);
rand_seed = tv.tv_sec ^ tv.tv_usec ^ getpid();
rand_seed = spec.tv_sec ^ spec.tv_nsec ^ getpid();
// in fast systems where pids can repeat in the same seconds we need this
for (i = 1; (s32)i < argc; i++)
for (j = 0; j < strlen(argv[i]); j++)