aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-02-13 23:01:15 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-02-13 23:01:15 +0800
commit0fe788aad6d55c440e04f6f64f1927613bd6b16b (patch)
treec349dbcbbbed9d9fedc8d47fa6f7b6a0cdabec9c
parente9dd9d2c7220594e2731b081990396429c5288d7 (diff)
downloaddexon-solidity-0fe788aad6d55c440e04f6f64f1927613bd6b16b.tar.gz
dexon-solidity-0fe788aad6d55c440e04f6f64f1927613bd6b16b.tar.zst
dexon-solidity-0fe788aad6d55c440e04f6f64f1927613bd6b16b.zip
Use std::chrono and not boost::posix_Time
-rw-r--r--test/RPCSession.cpp5
-rw-r--r--test/RPCSession.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp
index bf639e19..ff00d783 100644
--- a/test/RPCSession.cpp
+++ b/test/RPCSession.cpp
@@ -246,13 +246,14 @@ void RPCSession::test_mineBlocks(int _number)
// 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
- unsigned startTime = boost::posix_time::microsec_clock::local_time();
+ auto startTime = std::chrono::steady_clock::now();
unsigned sleepTime = m_sleepTime;
size_t tries = 0;
for (; ; ++tries)
{
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)
BOOST_FAIL("Error in test_mineBlocks: block mining timeout!");
if (fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())) >= startBlock + _number)
diff --git a/test/RPCSession.h b/test/RPCSession.h
index a0b1e9ef..414db323 100644
--- a/test/RPCSession.h
+++ b/test/RPCSession.h
@@ -127,7 +127,7 @@ private:
IPCSocket m_ipcSocket;
size_t m_rpcSequence = 1;
unsigned m_maxMiningTime = 15000; // 15 seconds
- unsigned m_sleepTime = 10;
+ unsigned m_sleepTime = 10; // 10 milliseconds
unsigned m_successfulMineRuns = 0;
std::vector<std::string> m_accounts;