mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use std::chrono and not boost::posix_Time
This commit is contained in:
parent
e9dd9d2c72
commit
0fe788aad6
@ -246,13 +246,14 @@ void RPCSession::test_mineBlocks(int _number)
|
|||||||
// We auto-calibrate the time it takes to mine the transaction.
|
// We auto-calibrate the time it takes to mine the transaction.
|
||||||
// It would be better to go without polling, but that would probably need a change to the test client
|
// It would be better to go without polling, but that would probably need a change to the test client
|
||||||
|
|
||||||
unsigned startTime = boost::posix_time::microsec_clock::local_time();
|
auto startTime = std::chrono::steady_clock::now();
|
||||||
unsigned sleepTime = m_sleepTime;
|
unsigned sleepTime = m_sleepTime;
|
||||||
size_t tries = 0;
|
size_t tries = 0;
|
||||||
for (; ; ++tries)
|
for (; ; ++tries)
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(chrono::milliseconds(sleepTime));
|
std::this_thread::sleep_for(chrono::milliseconds(sleepTime));
|
||||||
boost::posix_time::time_duration timeSpent = boost::posix_time::microsec_clock::local_time() - startTime;
|
auto endTime = std::chrono::steady_clock::now();
|
||||||
|
unsigned timeSpent = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count();
|
||||||
if (timeSpent > m_maxMiningTime)
|
if (timeSpent > m_maxMiningTime)
|
||||||
BOOST_FAIL("Error in test_mineBlocks: block mining timeout!");
|
BOOST_FAIL("Error in test_mineBlocks: block mining timeout!");
|
||||||
if (fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())) >= startBlock + _number)
|
if (fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())) >= startBlock + _number)
|
||||||
|
@ -127,7 +127,7 @@ private:
|
|||||||
IPCSocket m_ipcSocket;
|
IPCSocket m_ipcSocket;
|
||||||
size_t m_rpcSequence = 1;
|
size_t m_rpcSequence = 1;
|
||||||
unsigned m_maxMiningTime = 15000; // 15 seconds
|
unsigned m_maxMiningTime = 15000; // 15 seconds
|
||||||
unsigned m_sleepTime = 10;
|
unsigned m_sleepTime = 10; // 10 milliseconds
|
||||||
unsigned m_successfulMineRuns = 0;
|
unsigned m_successfulMineRuns = 0;
|
||||||
|
|
||||||
std::vector<std::string> m_accounts;
|
std::vector<std::string> m_accounts;
|
||||||
|
Loading…
Reference in New Issue
Block a user