mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-24 06:48:40 +02:00
Add the get_key() guard from the other branch
This commit is contained in:
@@ -155,6 +155,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
executor::inst()->ex_start();
|
||||
|
||||
using namespace std::chrono;
|
||||
uint64_t lastTime = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
|
||||
|
||||
int key;
|
||||
while(true)
|
||||
{
|
||||
@@ -174,6 +177,13 @@ int main(int argc, char *argv[])
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uint64_t currentTime = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
|
||||
|
||||
/* Hard guard to make sure we never get called more than twice per second */
|
||||
if( currentTime - lastTime < 500)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500 - (currentTime - lastTime)));
|
||||
lastTime = currentTime;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user