diff options
Diffstat (limited to 'src/util/rand.c')
-rw-r--r-- | src/util/rand.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/util/rand.c b/src/util/rand.c index 940faf947..2ed060573 100644 --- a/src/util/rand.c +++ b/src/util/rand.c @@ -32,7 +32,6 @@ GIT_INLINE(int) getseed(uint64_t *seed) HCRYPTPROV provider; SYSTEMTIME systemtime; FILETIME filetime, idletime, kerneltime, usertime; - bits convert; if (CryptAcquireContext(&provider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT|CRYPT_SILENT)) { @@ -67,7 +66,7 @@ GIT_INLINE(int) getseed(uint64_t *seed) *seed ^= ((uint64_t)GetCurrentProcessId() << 32); *seed ^= ((uint64_t)GetCurrentThreadId() << 48); - convert.f = git__timer(); *seed ^= (convert.d); + *seed ^= git_time_monotonic(); /* Mix in the addresses of some functions and variables */ *seed ^= (((uint64_t)((uintptr_t)seed) << 32)); @@ -82,9 +81,12 @@ GIT_INLINE(int) getseed(uint64_t *seed) { struct timeval tv; double loadavg[3]; - bits convert; int fd; +# if defined(GIT_RAND_GETLOADAVG) + bits convert; +# endif + # if defined(GIT_RAND_GETENTROPY) GIT_UNUSED((fd = 0)); @@ -131,7 +133,7 @@ GIT_INLINE(int) getseed(uint64_t *seed) GIT_UNUSED(loadavg[0]); # endif - convert.f = git__timer(); *seed ^= (convert.d); + *seed ^= git_time_monotonic(); /* Mix in the addresses of some variables */ *seed ^= ((uint64_t)((size_t)((void *)seed)) << 32); |