Revert "Replace gettimeofday with clock_gettime (#2159)"

This reverts commit 7c380a6612.
This commit is contained in:
vanhauser-thc
2024-07-14 10:18:23 +02:00
parent 7c380a6612
commit ccb952dde8
8 changed files with 51 additions and 50 deletions

View File

@ -52,6 +52,7 @@
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/time.h>
static u8 **as_params; /* Parameters passed to the real 'as' */
@ -556,7 +557,8 @@ int main(int argc, char **argv) {
int status;
u8 *inst_ratio_str = getenv("AFL_INST_RATIO");
struct timespec spec;
struct timeval tv;
struct timezone tz;
clang_mode = !!getenv(CLANG_ENV_VAR);
@ -607,9 +609,9 @@ int main(int argc, char **argv) {
}
clock_gettime(CLOCK_REALTIME, &spec);
gettimeofday(&tv, &tz);
rand_seed = spec.tv_sec ^ spec.tv_nsec ^ getpid();
rand_seed = tv.tv_sec ^ tv.tv_usec ^ 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++)