Commit f0f0291 1 parent 948bb36 commit f0f0291 Copy full SHA for f0f0291
File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 19
19
#endif
20
20
21
21
#include < algorithm>
22
+ #include < atomic>
22
23
#include < chrono>
23
24
#include < climits>
24
25
#include < thread>
@@ -73,10 +74,11 @@ void RandAddSeedPerfmon(CSHA512& hasher)
73
74
// Seed with the entire set of perfmon data
74
75
75
76
// 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;
80
82
81
83
std::vector<unsigned char > vData (250000 , 0 );
82
84
long ret = 0 ;
You can’t perform that action at this time.
0 commit comments