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

Change-Id: I7e859989c833001f49b286d4a9917f4dc740b4a4
diff --git a/tools/ndn-autoconfig.cpp b/tools/ndn-autoconfig.cpp
index a92fad3..a62b7e7 100644
--- a/tools/ndn-autoconfig.cpp
+++ b/tools/ndn-autoconfig.cpp
@@ -44,7 +44,7 @@
   discoverHubStage1()
   {
     ndn::Interest interest(ndn::Name("/localhop/ndn-autoconf/hub"));
-    interest.setInterestLifetime(4000); // 4 seconds
+    interest.setInterestLifetime(ndn::time::milliseconds(4000)); // 4 seconds
     interest.setMustBeFresh(true);
     
     std::cerr << "Stage 1: Trying muticast discovery..." << std::endl;
@@ -249,6 +249,8 @@
       connectToHub(uri);
       return true;
     }
+
+    return false;
   }
 };
 
diff --git a/tools/ndn-autoconfigserver.cpp b/tools/ndn-autoconfigserver.cpp
index e7b9975..070b84c 100644
--- a/tools/ndn-autoconfigserver.cpp
+++ b/tools/ndn-autoconfigserver.cpp
@@ -34,7 +34,7 @@
   {
     size_t total_len = 0;
     ndn::Data data(ndn::Name(interest.getName()).appendVersion());
-    data.setFreshnessPeriod(1000); // 1 sec
+    data.setFreshnessPeriod(time::hours(1)); // 1 hour
     
     // create and encode uri block
     Block uriBlock = dataBlock(tlv::nfd::Uri,
diff --git a/tools/ndn-tlv-peek.cpp b/tools/ndn-tlv-peek.cpp
index 8ed429d..cb7adfd 100644
--- a/tools/ndn-tlv-peek.cpp
+++ b/tools/ndn-tlv-peek.cpp
@@ -40,9 +40,9 @@
       "   [-r]          - set ChildSelector to select rightmost child\n"
       "   [-m min]      - set MinSuffixComponents\n"
       "   [-M max]      - set MaxSuffixComponents\n"
-      "   [-l lifetime] - set InterestLifetime in milliseconds\n"
+      "   [-l lifetime] - set InterestLifetime in time::milliseconds\n"
       "   [-p]          - print payload only, not full packet\n"
-      "   [-w timeout]  - set Timeout in milliseconds\n"
+      "   [-w timeout]  - set Timeout in time::milliseconds\n"
       "   [-h]          - print help and exit\n\n";
     exit(1);
   }
@@ -80,7 +80,7 @@
   {
     if (interestLifetime < 0)
       usage();
-    m_interestLifetime = interestLifetime;
+    m_interestLifetime = ndn::time::milliseconds(interestLifetime);
   }
 
   void
@@ -94,7 +94,7 @@
   {
     if (timeout < 0)
       usage();
-    m_timeout = timeout;
+    m_timeout = ndn::time::milliseconds(timeout);
   }
 
   void
@@ -105,10 +105,10 @@
       usage();
   }
 
-  int
+  ndn::time::milliseconds
   getDefaultInterestLifetime()
   {
-    return 4000;
+    return ndn::time::seconds(4);
   }
 
   ndn::Interest
@@ -124,7 +124,7 @@
       interestPacket.setMinSuffixComponents(m_minSuffixComponents);
     if (m_maxSuffixComponents >= 0)
       interestPacket.setMaxSuffixComponents(m_maxSuffixComponents);
-    if (m_interestLifetime < 0)
+    if (m_interestLifetime < ndn::time::milliseconds::zero())
       interestPacket.setInterestLifetime(getDefaultInterestLifetime());
     else
       interestPacket.setInterestLifetime(m_interestLifetime);
@@ -163,9 +163,9 @@
                                                    this, _1, _2),
                                ndn::func_lib::bind(&NdnTlvPeek::onTimeout,
                                                    this, _1));
-        if (m_timeout < 0)
+        if (m_timeout < ndn::time::milliseconds::zero())
           {
-            if (m_interestLifetime < 0)
+            if (m_interestLifetime < ndn::time::milliseconds::zero())
               m_face.processEvents(getDefaultInterestLifetime());
             else
               m_face.processEvents(m_interestLifetime);
@@ -193,9 +193,9 @@
   bool m_isChildSelectorRightmost;
   int m_minSuffixComponents;
   int m_maxSuffixComponents;
-  int m_interestLifetime;
+  ndn::time::milliseconds m_interestLifetime;
   bool m_isPayloadOnlySet;
-  int m_timeout;
+  ndn::time::milliseconds m_timeout;
   std::string m_prefixName;
   bool m_isDataReceived;
   ndn::ptr_lib::shared_ptr<boost::asio::io_service> m_ioService;
diff --git a/tools/ndn-tlv-poke.cpp b/tools/ndn-tlv-poke.cpp
index 51a12d9..ba02e5e 100644
--- a/tools/ndn-tlv-poke.cpp
+++ b/tools/ndn-tlv-poke.cpp
@@ -41,8 +41,8 @@
       "SignatureSha256WithRsa\n"
       "   [-i identity] - set identity to be used for signing\n"
       "   [-F]          - set FinalBlockId to the last component of Name\n"
-      "   [-x]          - set FreshnessPeriod in milliseconds\n"
-      "   [-w timeout]  - set Timeout in milliseconds\n"
+      "   [-x]          - set FreshnessPeriod in time::milliseconds\n"
+      "   [-w timeout]  - set Timeout in time::milliseconds\n"
       "   [-h]          - print help and exit\n\n";
     exit(1);
   }
@@ -76,7 +76,7 @@
   {
     if (freshnessPeriod < 0)
       usage();
-    m_freshnessPeriod = freshnessPeriod;
+    m_freshnessPeriod = ndn::time::milliseconds(freshnessPeriod);
   }
 
   void
@@ -84,7 +84,7 @@
   {
     if (timeout < 0)
       usage();
-    m_timeout = timeout;
+    m_timeout = ndn::time::milliseconds(timeout);
   }
 
   void
@@ -93,10 +93,10 @@
     m_prefixName = ndn::Name(prefixName);
   }
 
-  ndn::Milliseconds
+  ndn::time::milliseconds
   getDefaultTimeout()
   {
-    return 10000;
+    return ndn::time::seconds(10);
   }
 
   ndn::Data
@@ -107,7 +107,7 @@
     payloadStream << std::cin.rdbuf();
     std::string payload = payloadStream.str();
     dataPacket.setContent(reinterpret_cast<const uint8_t*>(payload.c_str()), payload.length());
-    if (m_freshnessPeriod >= 0)
+    if (m_freshnessPeriod >= ndn::time::milliseconds::zero())
       dataPacket.setFreshnessPeriod(m_freshnessPeriod);
     if (m_isLastAsFinalBlockIdSet)
       {
@@ -162,12 +162,12 @@
         else
           {
             m_face.setInterestFilter(m_prefixName,
-                                     ndn::func_lib::bind(&NdnTlvPoke::onInterest,
-                                                         this, _1, _2, dataPacket),
-                                     ndn::func_lib::bind(&NdnTlvPoke::onRegisterFailed,
-                                                         this, _1, _2));
+                                     ndn::bind(&NdnTlvPoke::onInterest,
+                                               this, _1, _2, dataPacket),
+                                     ndn::bind(&NdnTlvPoke::onRegisterFailed,
+                                               this, _1, _2));
           }
-        if (m_timeout < 0)
+        if (m_timeout < ndn::time::milliseconds::zero())
           m_face.processEvents(getDefaultTimeout());
         else
           m_face.processEvents(m_timeout);
@@ -193,8 +193,8 @@
   bool m_isUseDigestSha256Set;
   ndn::shared_ptr<ndn::Name> m_identityName;
   bool m_isLastAsFinalBlockIdSet;
-  ndn::Milliseconds m_freshnessPeriod;
-  ndn::Milliseconds m_timeout;
+  ndn::time::milliseconds m_freshnessPeriod;
+  ndn::time::milliseconds m_timeout;
   ndn::Name m_prefixName;
   bool m_isDataSent;
   ndn::Face m_face;