about summary refs log tree commit diff
path: root/src/afl-as.c
diff options
context:
space:
mode:
authorcarpintero-de-c <175505615+carpintero-de-c@users.noreply.github.com>2024-07-14 03:55:58 +0530
committerGitHub <noreply@github.com>2024-07-14 00:25:58 +0200
commit7c380a6612f00e4a7ed02364dc2b3769e8edc8f8 (patch)
treefd78a050b4fa1372f6d023f10f3513a76e1ee769 /src/afl-as.c
parent3f26818d973c4929857977b7cdfcf26cc0a84eb3 (diff)
downloadafl++-7c380a6612f00e4a7ed02364dc2b3769e8edc8f8.tar.gz
Replace gettimeofday with clock_gettime (#2159)
Diffstat (limited to 'src/afl-as.c')
-rw-r--r--src/afl-as.c8
1 files changed, 3 insertions, 5 deletions
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 <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++)