mirror of
https://github.com/bellard/quickjs.git
synced 2024-11-25 15:18:12 +08:00
duplicated gettimeofday
This commit is contained in:
parent
f058e2a5f3
commit
a4eff5077e
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user