diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index 749e97c..e5aaab9 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -171,13 +171,13 @@
       // going out of this strategy's namespace
       return;
     }
-    this->getMeasurements().extendLifetime(measurementsEntry, MEASUREMENTS_LIFETIME);
+    this->getMeasurements().extendLifetime(*measurementsEntry, MEASUREMENTS_LIFETIME);
 
     shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
       this->getMeasurementsEntryInfo(measurementsEntry);
     measurementsEntryInfo->adjustPredictUp();
 
-    measurementsEntry = this->getMeasurements().getParent(measurementsEntry);
+    measurementsEntry = this->getMeasurements().getParent(*measurementsEntry);
   }
 }
 
@@ -198,13 +198,13 @@
       // going out of this strategy's namespace
       return;
     }
-    this->getMeasurements().extendLifetime(measurementsEntry, MEASUREMENTS_LIFETIME);
+    this->getMeasurements().extendLifetime(*measurementsEntry, MEASUREMENTS_LIFETIME);
 
     shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
       this->getMeasurementsEntryInfo(measurementsEntry);
     measurementsEntryInfo->updateBestFace(inFace);
 
-    measurementsEntry = this->getMeasurements().getParent(measurementsEntry);
+    measurementsEntry = this->getMeasurements().getParent(*measurementsEntry);
   }
 
   shared_ptr<PitEntryInfo> pitEntryInfo = pitEntry->getStrategyInfo<PitEntryInfo>();
@@ -231,7 +231,7 @@
   info = make_shared<MeasurementsEntryInfo>();
   entry->setStrategyInfo(info);
 
-  shared_ptr<measurements::Entry> parentEntry = this->getMeasurements().getParent(entry);
+  shared_ptr<measurements::Entry> parentEntry = this->getMeasurements().getParent(*entry);
   if (static_cast<bool>(parentEntry)) {
     shared_ptr<MeasurementsEntryInfo> parentInfo = this->getMeasurementsEntryInfo(parentEntry);
     BOOST_ASSERT(static_cast<bool>(parentInfo));
diff --git a/daemon/table/measurements-accessor.hpp b/daemon/table/measurements-accessor.hpp
index 2108435..872cff2 100644
--- a/daemon/table/measurements-accessor.hpp
+++ b/daemon/table/measurements-accessor.hpp
@@ -45,36 +45,37 @@
 
   ~MeasurementsAccessor();
 
-  /// find or insert a Measurements entry for name
+  /** \brief find or insert a Measurements entry for name
+   */
   shared_ptr<measurements::Entry>
   get(const Name& name);
 
-  /// find or insert a Measurements entry for fibEntry->getPrefix()
+  /** \brief find or insert a Measurements entry for fibEntry->getPrefix()
+   */
   shared_ptr<measurements::Entry>
   get(const fib::Entry& fibEntry);
 
-  /// find or insert a Measurements entry for pitEntry->getName()
+  /** \brief find or insert a Measurements entry for pitEntry->getName()
+   */
   shared_ptr<measurements::Entry>
   get(const pit::Entry& pitEntry);
 
   /** \brief find or insert a Measurements entry for child's parent
-   *
-   *  If child is the root entry, returns null.
+   *  \retval nullptr if child is the root entry
    */
   shared_ptr<measurements::Entry>
-  getParent(shared_ptr<measurements::Entry> child);
+  getParent(const measurements::Entry& child);
 
   /** \brief extend lifetime of an entry
    *
    *  The entry will be kept until at least now()+lifetime.
    */
   void
-  extendLifetime(shared_ptr<measurements::Entry> entry, const time::nanoseconds& lifetime);
+  extendLifetime(measurements::Entry& entry, const time::nanoseconds& lifetime);
 
 private:
   /** \brief perform access control to Measurements entry
-   *
-   *  \return entry if strategy has access to namespace, otherwise 0
+   *  \return entry if strategy has access to namespace, otherwise nullptr
    */
   shared_ptr<measurements::Entry>
   filter(const shared_ptr<measurements::Entry>& entry);
@@ -104,13 +105,13 @@
 }
 
 inline shared_ptr<measurements::Entry>
-MeasurementsAccessor::getParent(shared_ptr<measurements::Entry> child)
+MeasurementsAccessor::getParent(const measurements::Entry& child)
 {
   return this->filter(m_measurements.getParent(child));
 }
 
 inline void
-MeasurementsAccessor::extendLifetime(shared_ptr<measurements::Entry> entry,
+MeasurementsAccessor::extendLifetime(measurements::Entry& entry,
                                      const time::nanoseconds& lifetime)
 {
   m_measurements.extendLifetime(entry, lifetime);
diff --git a/daemon/table/measurements.cpp b/daemon/table/measurements.cpp
index 4943bf4..8a24306 100644
--- a/daemon/table/measurements.cpp
+++ b/daemon/table/measurements.cpp
@@ -36,30 +36,20 @@
 {
 }
 
-Measurements::~Measurements()
-{
-}
-
-static inline bool
-predicate_NameTreeEntry_hasMeasurementsEntry(const name_tree::Entry& entry)
-{
-  return static_cast<bool>(entry.getMeasurementsEntry());
-}
-
 shared_ptr<measurements::Entry>
-Measurements::get(shared_ptr<name_tree::Entry> nameTreeEntry)
+Measurements::get(name_tree::Entry& nte)
 {
-  shared_ptr<measurements::Entry> entry = nameTreeEntry->getMeasurementsEntry();
-  if (static_cast<bool>(entry))
+  shared_ptr<measurements::Entry> entry = nte.getMeasurementsEntry();
+  if (entry != nullptr)
     return entry;
 
-  entry = make_shared<measurements::Entry>(nameTreeEntry->getPrefix());
-  nameTreeEntry->setMeasurementsEntry(entry);
+  entry = make_shared<measurements::Entry>(nte.getPrefix());
+  nte.setMeasurementsEntry(entry);
   ++m_nItems;
 
   entry->m_expiry = time::steady_clock::now() + getInitialLifetime();
   entry->m_cleanup = scheduler::schedule(getInitialLifetime(),
-                                         bind(&Measurements::cleanup, this, entry));
+                                         bind(&Measurements::cleanup, this, ref(*entry)));
 
   return entry;
 }
@@ -67,101 +57,86 @@
 shared_ptr<measurements::Entry>
 Measurements::get(const Name& name)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(name);
-  return get(nameTreeEntry);
+  shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(name);
+  return this->get(*nte);
 }
 
 shared_ptr<measurements::Entry>
 Measurements::get(const fib::Entry& fibEntry)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.get(fibEntry);
-
-  BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
-
-  return get(nameTreeEntry);
+  shared_ptr<name_tree::Entry> nte = m_nameTree.get(fibEntry);
+  return this->get(*nte);
 }
 
 shared_ptr<measurements::Entry>
 Measurements::get(const pit::Entry& pitEntry)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.get(pitEntry);
-
-  BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
-
-  return get(nameTreeEntry);
+  shared_ptr<name_tree::Entry> nte = m_nameTree.get(pitEntry);
+  return this->get(*nte);
 }
 
 shared_ptr<measurements::Entry>
-Measurements::getParent(shared_ptr<measurements::Entry> child)
+Measurements::getParent(const measurements::Entry& child)
 {
-  BOOST_ASSERT(child);
-
-  if (child->getName().size() == 0) {
-    return shared_ptr<measurements::Entry>();
+  if (child.getName().size() == 0) { // the root entry
+    return nullptr;
   }
 
-  shared_ptr<name_tree::Entry> nameTreeChild = m_nameTree.get(*child);
-  shared_ptr<name_tree::Entry> nameTreeEntry = nameTreeChild->getParent();
-  if (static_cast<bool>(nameTreeEntry)) {
-    return this->get(nameTreeEntry);
-  }
-  else {
-    BOOST_ASSERT(nameTreeChild->getPrefix().size() == 0); // root entry has no parent
-    return shared_ptr<measurements::Entry>();
-  }
+  shared_ptr<name_tree::Entry> nteChild = m_nameTree.get(child);
+  shared_ptr<name_tree::Entry> nte = nteChild->getParent();
+  BOOST_ASSERT(nte != nullptr);
+  return this->get(*nte);
 }
 
 shared_ptr<measurements::Entry>
 Measurements::findLongestPrefixMatch(const Name& name) const
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry =
-    m_nameTree.findLongestPrefixMatch(name, &predicate_NameTreeEntry_hasMeasurementsEntry);
-  if (static_cast<bool>(nameTreeEntry)) {
-    return nameTreeEntry->getMeasurementsEntry();
+  shared_ptr<name_tree::Entry> nte = m_nameTree.findLongestPrefixMatch(name,
+      [] (const name_tree::Entry& nte) { return nte.getMeasurementsEntry() != nullptr; });
+  if (nte != nullptr) {
+    return nte->getMeasurementsEntry();
   }
-  return shared_ptr<measurements::Entry>();
+  return nullptr;
 }
 
 shared_ptr<measurements::Entry>
 Measurements::findExactMatch(const Name& name) const
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(name);
-  if (static_cast<bool>(nameTreeEntry))
-    return nameTreeEntry->getMeasurementsEntry();
-  return shared_ptr<measurements::Entry>();
+  shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(name);
+  if (nte != nullptr)
+    return nte->getMeasurementsEntry();
+  return nullptr;
 }
 
 void
-Measurements::extendLifetime(shared_ptr<measurements::Entry> entry,
+Measurements::extendLifetime(measurements::Entry& entry,
                              const time::nanoseconds& lifetime)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.get(*entry);
-  if (!static_cast<bool>(nameTreeEntry) ||
-      nameTreeEntry->getMeasurementsEntry().get() != entry.get()) {
+  shared_ptr<name_tree::Entry> nte = m_nameTree.get(entry);
+  if (nte == nullptr ||
+      nte->getMeasurementsEntry().get() != &entry) {
     // entry is already gone; it is a dangling reference
     return;
   }
 
   time::steady_clock::TimePoint expiry = time::steady_clock::now() + lifetime;
-  if (entry->m_expiry >= expiry) {
+  if (entry.m_expiry >= expiry) {
     // has longer lifetime, not extending
     return;
   }
 
-  scheduler::cancel(entry->m_cleanup);
-  entry->m_expiry = expiry;
-  entry->m_cleanup = scheduler::schedule(lifetime, bind(&Measurements::cleanup, this, entry));
+  scheduler::cancel(entry.m_cleanup);
+  entry.m_expiry = expiry;
+  entry.m_cleanup = scheduler::schedule(lifetime, bind(&Measurements::cleanup, this, ref(entry)));
 }
 
 void
-Measurements::cleanup(shared_ptr<measurements::Entry> entry)
+Measurements::cleanup(measurements::Entry& entry)
 {
-  BOOST_ASSERT(static_cast<bool>(entry));
-
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.get(*entry);
-  if (static_cast<bool>(nameTreeEntry)) {
-    nameTreeEntry->setMeasurementsEntry(shared_ptr<measurements::Entry>());
-    m_nameTree.eraseEntryIfEmpty(nameTreeEntry);
+  shared_ptr<name_tree::Entry> nte = m_nameTree.get(entry);
+  if (nte != nullptr) {
+    nte->setMeasurementsEntry(nullptr);
+    m_nameTree.eraseEntryIfEmpty(nte);
     m_nItems--;
   }
 }
diff --git a/daemon/table/measurements.hpp b/daemon/table/measurements.hpp
index 7478c58..71d8db5 100644
--- a/daemon/table/measurements.hpp
+++ b/daemon/table/measurements.hpp
@@ -49,54 +49,56 @@
   explicit
   Measurements(NameTree& nametree);
 
-  ~Measurements();
-
-  /// find or insert a Measurements entry for name
+  /** \brief find or insert a Measurements entry for name
+   */
   shared_ptr<measurements::Entry>
   get(const Name& name);
 
-  /// find or insert a Measurements entry for fibEntry->getPrefix()
+  /** \brief find or insert a Measurements entry for fibEntry->getPrefix()
+   */
   shared_ptr<measurements::Entry>
   get(const fib::Entry& fibEntry);
 
-  /// find or insert a Measurements entry for pitEntry->getName()
+  /** \brief find or insert a Measurements entry for pitEntry->getName()
+   */
   shared_ptr<measurements::Entry>
   get(const pit::Entry& pitEntry);
 
-  /** find or insert a Measurements entry for child's parent
-   *
-   *  If child is the root entry, returns null.
+  /** \brief find or insert a Measurements entry for child's parent
+   *  \retval nullptr if child is the root entry
    */
   shared_ptr<measurements::Entry>
-  getParent(shared_ptr<measurements::Entry> child);
+  getParent(const measurements::Entry& child);
 
-  /// perform a longest prefix match
+  /** \brief perform a longest prefix match
+   */
   shared_ptr<measurements::Entry>
   findLongestPrefixMatch(const Name& name) const;
 
-  /// perform an exact match
+  /** \brief perform an exact match
+   */
   shared_ptr<measurements::Entry>
   findExactMatch(const Name& name) const;
 
   static time::nanoseconds
   getInitialLifetime();
 
-  /** extend lifetime of an entry
+  /** \brief extend lifetime of an entry
    *
    *  The entry will be kept until at least now()+lifetime.
    */
   void
-  extendLifetime(shared_ptr<measurements::Entry> entry, const time::nanoseconds& lifetime);
+  extendLifetime(measurements::Entry& entry, const time::nanoseconds& lifetime);
 
   size_t
   size() const;
 
 private:
   void
-  cleanup(shared_ptr<measurements::Entry> entry);
+  cleanup(measurements::Entry& entry);
 
   shared_ptr<measurements::Entry>
-  get(shared_ptr<name_tree::Entry> nameTreeEntry);
+  get(name_tree::Entry& nte);
 
 private:
   NameTree& m_nameTree;
diff --git a/tests/daemon/table/measurements-accessor.cpp b/tests/daemon/table/measurements-accessor.cpp
index cbcbe5a..8d09ca4 100644
--- a/tests/daemon/table/measurements-accessor.cpp
+++ b/tests/daemon/table/measurements-accessor.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "table/measurements-accessor.hpp"
 #include "fw/strategy.hpp"
@@ -67,10 +68,8 @@
 {
   Forwarder forwarder;
 
-  shared_ptr<MeasurementsAccessorTestStrategy> strategy1 =
-    make_shared<MeasurementsAccessorTestStrategy>(ref(forwarder), "ndn:/strategy1");
-  shared_ptr<MeasurementsAccessorTestStrategy> strategy2 =
-    make_shared<MeasurementsAccessorTestStrategy>(ref(forwarder), "ndn:/strategy2");
+  auto strategy1 = make_shared<MeasurementsAccessorTestStrategy>(ref(forwarder), "ndn:/strategy1");
+  auto strategy2 = make_shared<MeasurementsAccessorTestStrategy>(ref(forwarder), "ndn:/strategy2");
 
   Name nameRoot("ndn:/");
   Name nameA   ("ndn:/A");
@@ -95,7 +94,7 @@
   BOOST_CHECK_EQUAL(static_cast<bool>(accessor1.get(nameAD  )), false);
 
   shared_ptr<measurements::Entry> entryRoot = forwarder.getMeasurements().get(nameRoot);
-  BOOST_CHECK_NO_THROW(accessor1.getParent(entryRoot));
+  BOOST_CHECK_NO_THROW(accessor1.getParent(*entryRoot));
 
   BOOST_CHECK_EQUAL(static_cast<bool>(accessor2.get(nameRoot)), false);
   BOOST_CHECK_EQUAL(static_cast<bool>(accessor2.get(nameA   )), true);
diff --git a/tests/daemon/table/measurements.cpp b/tests/daemon/table/measurements.cpp
index 30b71c4..63254bd 100644
--- a/tests/daemon/table/measurements.cpp
+++ b/tests/daemon/table/measurements.cpp
@@ -43,23 +43,22 @@
   Name nameAB("ndn:/A/B");
 
   shared_ptr<measurements::Entry> entryAB = measurements.get(nameAB);
-  BOOST_REQUIRE(static_cast<bool>(entryAB));
+  BOOST_REQUIRE(entryAB != nullptr);
   BOOST_CHECK_EQUAL(entryAB->getName(), nameAB);
 
   shared_ptr<measurements::Entry> entry0 = measurements.get(name0);
-  BOOST_REQUIRE(static_cast<bool>(entry0));
+  BOOST_REQUIRE(entry0 != nullptr);
 
-  shared_ptr<measurements::Entry> entryA = measurements.getParent(entryAB);
-  BOOST_REQUIRE(static_cast<bool>(entryA));
+  shared_ptr<measurements::Entry> entryA = measurements.getParent(*entryAB);
+  BOOST_REQUIRE(entryA != nullptr);
   BOOST_CHECK_EQUAL(entryA->getName(), nameA);
 
-  shared_ptr<measurements::Entry> entry0c = measurements.getParent(entryA);
+  shared_ptr<measurements::Entry> entry0c = measurements.getParent(*entryA);
   BOOST_CHECK_EQUAL(entry0, entry0c);
 }
 
-BOOST_AUTO_TEST_CASE(Lifetime)
+BOOST_FIXTURE_TEST_CASE(Lifetime, UnitTestTimeFixture)
 {
-  LimitedIo limitedIo;
   NameTree nameTree;
   Measurements measurements(nameTree);
   Name nameA("ndn:/A");
@@ -78,14 +77,14 @@
   const time::nanoseconds CHECK2 = time::seconds(5);
   const time::nanoseconds EXTEND_C = time::seconds(6);
   const time::nanoseconds CHECK3 = time::seconds(7);
-  BOOST_ASSERT(EXTEND_A < CHECK1 &&
-               CHECK1 < Measurements::getInitialLifetime() &&
-               Measurements::getInitialLifetime() < CHECK2 &&
-               CHECK2 < EXTEND_C &&
-               EXTEND_C < CHECK3);
+  BOOST_ASSERT(EXTEND_A < CHECK1);
+  BOOST_ASSERT(CHECK1 < Measurements::getInitialLifetime());
+  BOOST_ASSERT(Measurements::getInitialLifetime() < CHECK2);
+  BOOST_ASSERT(CHECK2 < EXTEND_C);
+  BOOST_ASSERT(EXTEND_C < CHECK3);
 
-  measurements.extendLifetime(entryA, EXTEND_A);
-  measurements.extendLifetime(entryC, EXTEND_C);
+  measurements.extendLifetime(*entryA, EXTEND_A);
+  measurements.extendLifetime(*entryC, EXTEND_C);
   // remaining lifetime:
   //   A = initial lifetime, because it's extended by less duration
   //   B = initial lifetime
@@ -94,39 +93,33 @@
   entryB.reset();
   entryC.reset();
 
-  BOOST_CHECK_EQUAL(limitedIo.run(LimitedIo::UNLIMITED_OPS, CHECK1), LimitedIo::EXCEED_TIME);
-  BOOST_CHECK_EQUAL(static_cast<bool>(measurements.findExactMatch(nameA)), true);
-  BOOST_CHECK_EQUAL(static_cast<bool>(measurements.findExactMatch(nameB)), true);
-  BOOST_CHECK_EQUAL(static_cast<bool>(measurements.findExactMatch(nameC)), true);
+  this->advanceClocks(time::milliseconds(100), CHECK1);
+  BOOST_CHECK(measurements.findExactMatch(nameA) != nullptr);
+  BOOST_CHECK(measurements.findExactMatch(nameB) != nullptr);
+  BOOST_CHECK(measurements.findExactMatch(nameC) != nullptr);
   BOOST_CHECK_EQUAL(measurements.size(), 3);
 
-  BOOST_CHECK_EQUAL(limitedIo.run(LimitedIo::UNLIMITED_OPS, CHECK2 - CHECK1),
-                    LimitedIo::EXCEED_TIME);
-  BOOST_CHECK_EQUAL(static_cast<bool>(measurements.findExactMatch(nameA)), false);
-  BOOST_CHECK_EQUAL(static_cast<bool>(measurements.findExactMatch(nameB)), false);
-  BOOST_CHECK_EQUAL(static_cast<bool>(measurements.findExactMatch(nameC)), true);
+  this->advanceClocks(time::milliseconds(100), CHECK2 - CHECK1);
+  BOOST_CHECK(measurements.findExactMatch(nameA) == nullptr);
+  BOOST_CHECK(measurements.findExactMatch(nameB) == nullptr);
+  BOOST_CHECK(measurements.findExactMatch(nameC) != nullptr);
   BOOST_CHECK_EQUAL(measurements.size(), 1);
 
-  BOOST_CHECK_EQUAL(limitedIo.run(LimitedIo::UNLIMITED_OPS, CHECK3 - CHECK2),
-                    LimitedIo::EXCEED_TIME);
-  BOOST_CHECK_EQUAL(static_cast<bool>(measurements.findExactMatch(nameA)), false);
-  BOOST_CHECK_EQUAL(static_cast<bool>(measurements.findExactMatch(nameB)), false);
-  BOOST_CHECK_EQUAL(static_cast<bool>(measurements.findExactMatch(nameC)), false);
+  this->advanceClocks(time::milliseconds(100), CHECK3 - CHECK2);
+  BOOST_CHECK(measurements.findExactMatch(nameA) == nullptr);
+  BOOST_CHECK(measurements.findExactMatch(nameB) == nullptr);
+  BOOST_CHECK(measurements.findExactMatch(nameC) == nullptr);
   BOOST_CHECK_EQUAL(measurements.size(), 0);
 }
 
-BOOST_AUTO_TEST_CASE(EraseNameTreeEntry)
+BOOST_FIXTURE_TEST_CASE(EraseNameTreeEntry, UnitTestTimeFixture)
 {
-  LimitedIo limitedIo;
   NameTree nameTree;
   Measurements measurements(nameTree);
   size_t nNameTreeEntriesBefore = nameTree.size();
 
   shared_ptr<measurements::Entry> entry = measurements.get("/A");
-  BOOST_CHECK_EQUAL(
-    limitedIo.run(LimitedIo::UNLIMITED_OPS,
-                  Measurements::getInitialLifetime() + time::milliseconds(10)),
-    LimitedIo::EXCEED_TIME);
+  this->advanceClocks(Measurements::getInitialLifetime() + time::milliseconds(10));
   BOOST_CHECK_EQUAL(measurements.size(), 0);
   BOOST_CHECK_EQUAL(nameTree.size(), nNameTreeEntriesBefore);
 }
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index d122189..e3bc0b5 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -64,7 +64,7 @@
  */
 class UnitTestTimeFixture : public BaseFixture
 {
-public:
+protected:
   UnitTestTimeFixture()
     : steadyClock(make_shared<time::UnitTestSteadyClock>())
     , systemClock(make_shared<time::UnitTestSystemClock>())
@@ -88,9 +88,38 @@
   void
   advanceClocks(const time::nanoseconds& tick, size_t nTicks = 1)
   {
-    for (size_t i = 0; i < nTicks; ++i) {
-      steadyClock->advance(tick);
-      systemClock->advance(tick);
+    BOOST_ASSERT(nTicks >= 0);
+
+    this->advanceClocks(tick, tick * nTicks);
+  }
+
+  /** \brief advance steady and system clocks
+   *
+   *  Clocks are advanced in increments of \p tick for \p total time.
+   *  The last increment might be shorter than \p tick.
+   *  After each tick, global io_service is polled to process pending I/O events.
+   *
+   *  Exceptions thrown during I/O events are propagated to the caller.
+   *  Clock advancing would stop in case of an exception.
+   */
+  void
+  advanceClocks(const time::nanoseconds& tick, const time::nanoseconds& total)
+  {
+    BOOST_ASSERT(tick > time::nanoseconds::zero());
+    BOOST_ASSERT(total >= time::nanoseconds::zero());
+
+    time::nanoseconds remaining = total;
+    while (remaining > time::nanoseconds::zero()) {
+      if (remaining >= tick) {
+        steadyClock->advance(tick);
+        systemClock->advance(tick);
+        remaining -= tick;
+      }
+      else {
+        steadyClock->advance(remaining);
+        systemClock->advance(remaining);
+        remaining = time::nanoseconds::zero();
+      }
 
       if (g_io.stopped())
         g_io.reset();
