File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1919#endif
2020
2121#include < algorithm>
22+ #include < atomic>
2223#include < chrono>
2324#include < climits>
2425#include < thread>
@@ -73,10 +74,11 @@ void RandAddSeedPerfmon(CSHA512& hasher)
7374 // Seed with the entire set of perfmon data
7475
7576 // This can take up to 2 seconds, so only do it every 10 minutes
76- static int64_t nLastPerfmon;
77- if (GetTime () < nLastPerfmon + 10 * 60 )
78- return ;
79- nLastPerfmon = GetTime ();
77+ static std::atomic<std::chrono::seconds> last_perfmon{std::chrono::seconds{0 }};
78+ auto last_time = last_perfmon.load ();
79+ auto current_time = GetTime<std::chrono::seconds>();
80+ if (current_time < last_time + std::chrono::minutes{10 }) return ;
81+ last_perfmon = current_time;
8082
8183 std::vector<unsigned char > vData (250000 , 0 );
8284 long ret = 0 ;
You can’t perform that action at this time.
0 commit comments