summaryrefslogtreecommitdiffstats
path: root/cli-miner.cpp
diff options
context:
space:
mode:
authorfireice-uk <fireice-uk@users.noreply.github.com>2017-05-26 18:59:49 +0100
committerfireice-uk <fireice-uk@users.noreply.github.com>2017-05-26 18:59:49 +0100
commit07ea73dbc3e71eb68ed6b5c10c6fd83f2357c9f1 (patch)
tree155654522c104ea1d550b36c3ec1f14acca73dfc /cli-miner.cpp
parent08f82b56a4a1b8ca6635ef61e37e08b5546e9144 (diff)
downloadxmr-stak-07ea73dbc3e71eb68ed6b5c10c6fd83f2357c9f1.zip
xmr-stak-07ea73dbc3e71eb68ed6b5c10c6fd83f2357c9f1.tar.gz
Add the get_key() guard from the other branch
Diffstat (limited to 'cli-miner.cpp')
-rw-r--r--cli-miner.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/cli-miner.cpp b/cli-miner.cpp
index 2cbe6d9..2f9a635 100644
--- a/cli-miner.cpp
+++ b/cli-miner.cpp
@@ -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;
OpenPOWER on IntegriCloud