all: Update code to compile with latest time-related changes in ndn-cpp-dev library

Change-Id: I7e859989c833001f49b286d4a9917f4dc740b4a4
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 4ab852e..e46bd5a 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -217,7 +217,7 @@
     const pit::InRecordCollection& inRecords = pitEntry->getInRecords();
     for (pit::InRecordCollection::const_iterator it = inRecords.begin();
                                                  it != inRecords.end(); ++it) {
-      if (it->getExpiry() > time::now()) {
+      if (it->getExpiry() > time::steady_clock::now()) {
         pendingDownstreams.insert(it->getFace());
       }
     }
@@ -293,8 +293,8 @@
     std::max_element(inRecords.begin(), inRecords.end(),
     &compare_InRecord_expiry);
 
-  time::Point lastExpiry = lastExpiring->getExpiry();
-  time::Duration lastExpiryFromNow = lastExpiry  - time::now();
+  time::steady_clock::TimePoint lastExpiry = lastExpiring->getExpiry();
+  time::nanoseconds lastExpiryFromNow = lastExpiry  - time::steady_clock::now();
   if (lastExpiryFromNow <= time::seconds(0)) {
     // TODO all InRecords are already expired; will this happen?
   }
@@ -312,7 +312,7 @@
     return;
   }
 
-  time::Duration stragglerTime = time::milliseconds(100);
+  time::nanoseconds stragglerTime = time::milliseconds(100);
 
   pitEntry->m_stragglerTimer = scheduler::schedule(stragglerTime,
     bind(&Pit::erase, &m_pit, pitEntry));
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index 79d8b1a..d0b43f1 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -20,9 +20,9 @@
 {
 }
 
-const time::Duration NccStrategy::DEFER_FIRST_WITHOUT_BEST_FACE = time::microseconds(4000);
-const time::Duration NccStrategy::DEFER_RANGE_WITHOUT_BEST_FACE = time::microseconds(75000);
-const time::Duration NccStrategy::MEASUREMENTS_LIFETIME = time::seconds(16);
+const time::nanoseconds NccStrategy::DEFER_FIRST_WITHOUT_BEST_FACE = time::microseconds(4000);
+const time::nanoseconds NccStrategy::DEFER_RANGE_WITHOUT_BEST_FACE = time::microseconds(75000);
+const time::nanoseconds NccStrategy::MEASUREMENTS_LIFETIME = time::seconds(16);
 
 void
 NccStrategy::afterReceiveInterest(const Face& inFace,
@@ -47,8 +47,8 @@
   shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
     this->getMeasurementsEntryInfo(pitEntry);
 
-  time::Duration deferFirst = DEFER_FIRST_WITHOUT_BEST_FACE;
-  time::Duration deferRange = DEFER_RANGE_WITHOUT_BEST_FACE;
+  time::nanoseconds deferFirst = DEFER_FIRST_WITHOUT_BEST_FACE;
+  time::nanoseconds deferRange = DEFER_RANGE_WITHOUT_BEST_FACE;
   size_t nUpstreams = nexthops.size();
 
   shared_ptr<Face> bestFace = measurementsEntryInfo->getBestFace();
@@ -56,7 +56,8 @@
       pitEntry->canForwardTo(*bestFace)) {
     // TODO Should we use `randlow = 100 + nrand48(h->seed) % 4096U;` ?
     deferFirst = measurementsEntryInfo->m_prediction;
-    deferRange = static_cast<time::Duration>((deferFirst + time::microseconds(1)) / 2);
+    deferRange = time::nanoseconds((deferFirst.count() +
+                              static_cast<time::nanoseconds>(time::microseconds(1)).count()) / 2);
     --nUpstreams;
     this->sendInterest(pitEntry, bestFace);
     pitEntryInfo->m_bestFaceTimeout = scheduler::schedule(
@@ -75,8 +76,8 @@
     --nUpstreams;
   }
 
-  pitEntryInfo->m_maxInterval = std::max(time::microseconds(1),
-    static_cast<time::Duration>((2 * deferRange + nUpstreams - 1) / nUpstreams));
+  pitEntryInfo->m_maxInterval = std::max(static_cast<time::nanoseconds>(time::microseconds(1)),
+    time::nanoseconds((2 * deferRange.count() + nUpstreams - 1) / nUpstreams));
   pitEntryInfo->m_propagateTimer = scheduler::schedule(deferFirst,
     bind(&NccStrategy::doPropagate, this,
          weak_ptr<pit::Entry>(pitEntry), weak_ptr<fib::Entry>(fibEntry)));
@@ -120,8 +121,7 @@
 
   if (isForwarded) {
     static unsigned short seed[3];
-    time::Duration deferNext = static_cast<time::Duration>(
-                               nrand48(seed) % pitEntryInfo->m_maxInterval);
+    time::nanoseconds deferNext = time::nanoseconds(nrand48(seed) % pitEntryInfo->m_maxInterval.count());
     pitEntryInfo->m_propagateTimer = scheduler::schedule(deferNext,
     bind(&NccStrategy::doPropagate, this,
          weak_ptr<pit::Entry>(pitEntry), weak_ptr<fib::Entry>(fibEntry)));
@@ -206,11 +206,11 @@
 }
 
 
-const time::Duration NccStrategy::MeasurementsEntryInfo::INITIAL_PREDICTION =
+const time::nanoseconds NccStrategy::MeasurementsEntryInfo::INITIAL_PREDICTION =
                                                          time::microseconds(8192);
-const time::Duration NccStrategy::MeasurementsEntryInfo::MIN_PREDICTION =
+const time::nanoseconds NccStrategy::MeasurementsEntryInfo::MIN_PREDICTION =
                                                          time::microseconds(127);
-const time::Duration NccStrategy::MeasurementsEntryInfo::MAX_PREDICTION =
+const time::nanoseconds NccStrategy::MeasurementsEntryInfo::MAX_PREDICTION =
                                                          time::microseconds(160000);
 
 NccStrategy::MeasurementsEntryInfo::MeasurementsEntryInfo()
@@ -253,13 +253,13 @@
 void
 NccStrategy::MeasurementsEntryInfo::adjustPredictDown() {
   m_prediction = std::max(MIN_PREDICTION,
-    static_cast<time::Duration>(m_prediction - (m_prediction >> ADJUST_PREDICT_DOWN_SHIFT)));
+    time::nanoseconds(m_prediction.count() - (m_prediction.count() >> ADJUST_PREDICT_DOWN_SHIFT)));
 }
 
 void
 NccStrategy::MeasurementsEntryInfo::adjustPredictUp() {
   m_prediction = std::min(MAX_PREDICTION,
-    static_cast<time::Duration>(m_prediction + (m_prediction >> ADJUST_PREDICT_UP_SHIFT)));
+    time::nanoseconds(m_prediction.count() + (m_prediction.count() >> ADJUST_PREDICT_UP_SHIFT)));
 }
 
 void
diff --git a/daemon/fw/ncc-strategy.hpp b/daemon/fw/ncc-strategy.hpp
index ff9bcf3..6a41b1a 100644
--- a/daemon/fw/ncc-strategy.hpp
+++ b/daemon/fw/ncc-strategy.hpp
@@ -61,12 +61,12 @@
   public:
     weak_ptr<Face> m_bestFace;
     weak_ptr<Face> m_previousFace;
-    time::Duration m_prediction;
+    time::nanoseconds m_prediction;
 
-    static const time::Duration INITIAL_PREDICTION;
-    static const time::Duration MIN_PREDICTION;
+    static const time::nanoseconds INITIAL_PREDICTION;
+    static const time::nanoseconds MIN_PREDICTION;
     static const int ADJUST_PREDICT_DOWN_SHIFT = 7;
-    static const time::Duration MAX_PREDICTION;
+    static const time::nanoseconds MAX_PREDICTION;
     static const int ADJUST_PREDICT_UP_SHIFT = 3;
   };
 
@@ -83,7 +83,7 @@
     bool m_isNewInterest;
     EventId m_bestFaceTimeout;
     EventId m_propagateTimer;
-    time::Duration m_maxInterval;
+    time::nanoseconds m_maxInterval;
   };
 
 protected:
@@ -105,10 +105,10 @@
   static const Name STRATEGY_NAME;
 
 protected:
-  static const time::Duration DEFER_FIRST_WITHOUT_BEST_FACE;
-  static const time::Duration DEFER_RANGE_WITHOUT_BEST_FACE;
+  static const time::nanoseconds DEFER_FIRST_WITHOUT_BEST_FACE;
+  static const time::nanoseconds DEFER_RANGE_WITHOUT_BEST_FACE;
   static const int UPDATE_MEASUREMENTS_N_LEVELS = 2;
-  static const time::Duration MEASUREMENTS_LIFETIME;
+  static const time::nanoseconds MEASUREMENTS_LIFETIME;
 };
 
 } // namespace fw