From 7c380a6612f00e4a7ed02364dc2b3769e8edc8f8 Mon Sep 17 00:00:00 2001 From: carpintero-de-c <175505615+carpintero-de-c@users.noreply.github.com> Date: Sun, 14 Jul 2024 03:55:58 +0530 Subject: Replace gettimeofday with clock_gettime (#2159) --- src/afl-as.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/afl-as.c') diff --git a/src/afl-as.c b/src/afl-as.c index d4ddb94d..df487cbc 100644 --- a/src/afl-as.c +++ b/src/afl-as.c @@ -52,7 +52,6 @@ #include #include -#include 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++) -- cgit 1.4.1