From 7eaca149c1934f95e72bca55064fb3872a2bfb07 Mon Sep 17 00:00:00 2001 From: Donovan Hide Date: Wed, 15 Oct 2014 23:13:02 +0100 Subject: [PATCH] Remove boost_thread dependency (RIPD-216). Fixes RIPD-216 --- SConstruct | 1 - src/ripple/app/main/LoadManager.cpp | 18 ++++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/SConstruct b/SConstruct index a5fc99841..c753ed5b9 100644 --- a/SConstruct +++ b/SConstruct @@ -297,7 +297,6 @@ def config_env(toolchain, variant, env): 'boost_program_options', 'boost_regex', 'boost_system', - 'boost_thread' ] # We prefer static libraries for boost if env.get('BOOST_ROOT'): diff --git a/src/ripple/app/main/LoadManager.cpp b/src/ripple/app/main/LoadManager.cpp index 4c662c66b..618931bed 100644 --- a/src/ripple/app/main/LoadManager.cpp +++ b/src/ripple/app/main/LoadManager.cpp @@ -18,8 +18,6 @@ //============================================================================== #include -// REMOVE ASAP -#include namespace ripple { @@ -157,10 +155,10 @@ public: // void run () { - // VFALCO TODO replace this with a beast Time object? - // + using clock_type = std::chrono::steady_clock; + // Initialize the clock to the current time. - boost::posix_time::ptime t = boost::posix_time::microsec_clock::universal_time (); + auto t = clock_type::now(); while (! threadShouldExit ()) { @@ -222,17 +220,17 @@ public: getApp().getOPs ().reportFeeChange (); } - t += boost::posix_time::seconds (1); - boost::posix_time::time_duration when = t - boost::posix_time::microsec_clock::universal_time (); + t += std::chrono::seconds (1); + auto const duration = t - clock_type::now(); - if ((when.is_negative ()) || (when.total_seconds () > 1)) + if ((duration < std::chrono::seconds (0)) || (duration > std::chrono::seconds (1))) { m_journal.warning << "time jump"; - t = boost::posix_time::microsec_clock::universal_time (); + t = clock_type::now(); } else { - boost::this_thread::sleep (when); + std::this_thread::sleep_for (duration); } }