all: Update code to compile with latest time-related changes in ndn-cpp-dev library
Change-Id: I7e859989c833001f49b286d4a9917f4dc740b4a4
diff --git a/tests/core/limited-io.cpp b/tests/core/limited-io.cpp
index b381696..1eba63d 100644
--- a/tests/core/limited-io.cpp
+++ b/tests/core/limited-io.cpp
@@ -13,7 +13,7 @@
NFD_LOG_INIT("LimitedIo");
const int LimitedIo::UNLIMITED_OPS = std::numeric_limits<int>::max();
-const time::Duration LimitedIo::UNLIMITED_TIME = time::nanoseconds(-1);
+const time::nanoseconds LimitedIo::UNLIMITED_TIME = time::nanoseconds::min();
LimitedIo::LimitedIo()
: m_isRunning(false)
@@ -22,14 +22,14 @@
}
LimitedIo::StopReason
-LimitedIo::run(int nOpsLimit, time::Duration nTimeLimit)
+LimitedIo::run(int nOpsLimit, const time::nanoseconds& nTimeLimit)
{
BOOST_ASSERT(!m_isRunning);
m_isRunning = true;
m_reason = NO_WORK;
m_nOpsRemaining = nOpsLimit;
- if (nTimeLimit != UNLIMITED_TIME) {
+ if (nTimeLimit >= time::nanoseconds::zero()) {
m_timeout = scheduler::schedule(nTimeLimit, bind(&LimitedIo::afterTimeout, this));
}
diff --git a/tests/core/limited-io.hpp b/tests/core/limited-io.hpp
index 0aae290..d3968c2 100644
--- a/tests/core/limited-io.hpp
+++ b/tests/core/limited-io.hpp
@@ -38,7 +38,7 @@
* \param nTimeLimit time limit, pass UNLIMITED_TIME for no limit
*/
StopReason
- run(int nOpsLimit, time::Duration nTimeLimit);
+ run(int nOpsLimit, const time::nanoseconds& nTimeLimit);
/// count an operation
void
@@ -53,7 +53,7 @@
public:
static const int UNLIMITED_OPS;
- static const time::Duration UNLIMITED_TIME;
+ static const time::nanoseconds UNLIMITED_TIME;
private:
bool m_isRunning;
diff --git a/tests/core/scheduler.cpp b/tests/core/scheduler.cpp
index 806c982..87c75cf 100644
--- a/tests/core/scheduler.cpp
+++ b/tests/core/scheduler.cpp
@@ -57,18 +57,20 @@
BOOST_FIXTURE_TEST_CASE(Events, SchedulerFixture)
{
- scheduler::schedule(time::seconds(0.5), bind(&SchedulerFixture::event1, this));
+ scheduler::schedule(time::milliseconds(500), bind(&SchedulerFixture::event1, this));
- EventId i = scheduler::schedule(time::seconds(1.0), bind(&SchedulerFixture::event2, this));
+ EventId i = scheduler::schedule(time::seconds(1), bind(&SchedulerFixture::event2, this));
scheduler::cancel(i);
- scheduler::schedule(time::seconds(0.25), bind(&SchedulerFixture::event3, this));
+ scheduler::schedule(time::milliseconds(250), bind(&SchedulerFixture::event3, this));
- i = scheduler::schedule(time::seconds(0.05), bind(&SchedulerFixture::event2, this));
+ i = scheduler::schedule(time::milliseconds(50), bind(&SchedulerFixture::event2, this));
scheduler::cancel(i);
// TODO deprecate periodic event
- i = scheduler::getGlobalScheduler().schedulePeriodicEvent(time::seconds(0.3), time::seconds(0.1), bind(&SchedulerFixture::event4, this));
+ i = scheduler::getGlobalScheduler().schedulePeriodicEvent(time::milliseconds(300),
+ time::milliseconds(100),
+ bind(&SchedulerFixture::event4, this));
scheduler::schedule(time::seconds(1), bind(&scheduler::cancel, i));
g_io.run();
@@ -98,7 +100,7 @@
BOOST_FIXTURE_TEST_CASE(SelfCancel, SelfCancelFixture)
{
- m_selfEventId = scheduler::schedule(time::seconds(0.1),
+ m_selfEventId = scheduler::schedule(time::milliseconds(100),
bind(&SelfCancelFixture::cancelSelf, this));
BOOST_REQUIRE_NO_THROW(g_io.run());