Changeset View
Changeset View
Standalone View
Standalone View
src/randomenv.cpp
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
//! Necessary on some platforms | //! Necessary on some platforms | ||||
extern char **environ; | extern char **environ; | ||||
namespace { | namespace { | ||||
void RandAddSeedPerfmon(CSHA512 &hasher) { | void RandAddSeedPerfmon(CSHA512 &hasher) { | ||||
#ifdef WIN32 | #ifdef WIN32 | ||||
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom | |||||
// Seed with the entire set of perfmon data | // Seed with the entire set of perfmon data | ||||
// This can take up to 2 seconds, so only do it every 10 minutes | // This can take up to 2 seconds, so only do it every 10 minutes | ||||
static std::atomic<std::chrono::seconds> last_perfmon{ | static std::atomic<std::chrono::seconds> last_perfmon{ | ||||
std::chrono::seconds{0}}; | std::chrono::seconds{0}}; | ||||
auto last_time = last_perfmon.load(); | auto last_time = last_perfmon.load(); | ||||
auto current_time = GetTime<std::chrono::seconds>(); | auto current_time = GetTime<std::chrono::seconds>(); | ||||
if (current_time < last_time + std::chrono::minutes{10}) { | if (current_time < last_time + std::chrono::minutes{10}) { | ||||
▲ Show 20 Lines • Show All 472 Lines • Show Last 20 Lines |