duplicated gettimeofday

This commit is contained in:
Zia 2024-03-14 01:20:11 +03:30
parent f058e2a5f3
commit a4eff5077e

View File

@ -43243,11 +43243,10 @@ static uint64_t xorshift64star(uint64_t *pstate)
return x * 0x2545F4914F6CDD1D; return x * 0x2545F4914F6CDD1D;
} }
static int64_t date_now(void);
static void js_random_init(JSContext *ctx) static void js_random_init(JSContext *ctx)
{ {
struct timeval tv; ctx->random_state = date_now();
gettimeofday(&tv, NULL);
ctx->random_state = ((int64_t)tv.tv_sec * 1000000) + tv.tv_usec;
/* the state must be non zero */ /* the state must be non zero */
if (ctx->random_state == 0) if (ctx->random_state == 0)
ctx->random_state = 1; ctx->random_state = 1;