diff --git a/src/randomenv.cpp b/src/randomenv.cpp --- a/src/randomenv.cpp +++ b/src/randomenv.cpp @@ -19,6 +19,7 @@ #endif #include +#include #include #include #include @@ -72,11 +73,14 @@ // Seed with the entire set of perfmon data // This can take up to 2 seconds, so only do it every 10 minutes - static int64_t nLastPerfmon; - if (GetTime() < nLastPerfmon + 10 * 60) { + static std::atomic last_perfmon{ + std::chrono::seconds{0}}; + auto last_time = last_perfmon.load(); + auto current_time = GetTime(); + if (current_time < last_time + std::chrono::minutes{10}) { return; } - nLastPerfmon = GetTime(); + last_perfmon = current_time; std::vector vData(250000, 0); long ret = 0;