all: Refactoring work with time using boost::chrono

Now the library has two clocks: time::steady_clock and
time::system_clock, following (boost|std)::chrono.  In addition to
standard now() method, the library contains several helpers to convert
to/from UnixTimestamp (microsecond resolution) and IsoString (optional
microsecond resolution).  The IsoString conversions use
boost::posix_time routines, since boost::chrono supports extended IO
support only starting boost version 1.52 (Boost Chrono V2).

This commit breaks compatibility with previous API.  All time-related
Data/Interest calls must explicitly use time units to specify
FreshnessPeriod/InterestLifetime.

Brief usage/conversion guide:

- creation of time units does not support double/float types.  If
  necessary to create time unit from double, ``ndn::duration<double>`` (for
  seconds) needs to be used instead.  In some cases, this would also
  require ``ndn::duration_cast``, if the target is not ``ndn::nanoseconds``.
- ndn::getNow, ndn::ndn_getNowMilliseconds, ndn::time::now are all
  removed in favor of the now() method in a specific clock:

    * time::system_clock::now();
    * time::steady_clock::now();

- When necessary to convert system_clock::TimePoint to unix timestamp,
  ``time::toUnixTimestamp`` can be used.  This method return number of
  milliseconds since UNIX epoch as ``ndn::time::milliseconds`` type.
  Use count() method to obtain number as an integral value.

Change-Id: Icd688bc6766e008d60c3d2888173627874526e47
Refs: #1152
diff --git a/src/management/ndnd-forwarding-entry.hpp b/src/management/ndnd-forwarding-entry.hpp
index 3d262f1..03272b1 100644
--- a/src/management/ndnd-forwarding-entry.hpp
+++ b/src/management/ndnd-forwarding-entry.hpp
@@ -20,12 +20,12 @@
  * An ForwardingEntry holds an action and  Name prefix and other fields for an forwarding entry.
  */
 class ForwardingEntry {
-public:    
+public:
   ForwardingEntry(const std::string& action,
                   const Name& prefix,
                   int faceId = -1,
                   const ForwardingFlags& forwardingFlags = ForwardingFlags(),
-                  int freshnessPeriod = -1) 
+                  time::milliseconds freshnessPeriod = time::milliseconds::min())
     : action_(action)
     , prefix_(prefix)
     , faceId_(faceId)
@@ -36,52 +36,52 @@
 
   ForwardingEntry()
   : faceId_(-1)
-  , freshnessPeriod_(-1)
+  , freshnessPeriod_(time::milliseconds::min())
   {
   }
-  
-  const std::string& 
+
+  const std::string&
   getAction() const { return action_; }
 
-  void 
+  void
   setAction(const std::string& action) { action_ = action; wire_.reset(); }
-    
-  const Name& 
+
+  const Name&
   getPrefix() const { return prefix_; }
-  
+
   void
   setPrefix(const Name &prefix) { prefix_ = prefix; wire_.reset(); }
-  
-  int 
+
+  int
   getFaceId() const { return faceId_; }
 
-  void 
+  void
   setFaceId(int faceId) { faceId_ = faceId; wire_.reset(); }
-      
-  const ForwardingFlags& 
+
+  const ForwardingFlags&
   getForwardingFlags() const { return forwardingFlags_; }
 
-  void 
+  void
   setForwardingFlags(const ForwardingFlags& forwardingFlags) { forwardingFlags_ = forwardingFlags; wire_.reset(); }
-      
-  int 
+
+  const time::milliseconds&
   getFreshnessPeriod() const { return freshnessPeriod_; }
 
-  void 
-  setFreshnessPeriod(int freshnessPeriod) { freshnessPeriod_ = freshnessPeriod; wire_.reset(); }
+  void
+  setFreshnessPeriod(const time::milliseconds& freshnessPeriod) { freshnessPeriod_ = freshnessPeriod; wire_.reset(); }
 
   inline const Block&
   wireEncode() const;
-  
-  inline void 
+
+  inline void
   wireDecode(const Block &wire);
-  
+
 private:
   std::string action_;   /**< empty for none. */
   Name prefix_;
   int faceId_;           /**< -1 for none. */
   ForwardingFlags forwardingFlags_;
-  int freshnessPeriod_; /**< -1 for none. */
+  time::milliseconds freshnessPeriod_; /**< time::milliseconds::min() for none. */
 
   mutable Block wire_;
 };
@@ -98,7 +98,7 @@
   //                       FaceID?
   //                       ForwardingFlags?
   //                       FreshnessPeriod?
-  
+
   wire_ = Block(tlv::ndnd::ForwardingEntry);
 
   // Action
@@ -124,24 +124,24 @@
     (forwardingFlags_.wireEncode());
 
   // FreshnessPeriod
-  if (freshnessPeriod_ >= 0)
+  if (freshnessPeriod_ >= time::milliseconds::zero())
     {
       wire_.push_back
-        (nonNegativeIntegerBlock(Tlv::FreshnessPeriod, freshnessPeriod_));
+        (nonNegativeIntegerBlock(Tlv::FreshnessPeriod, freshnessPeriod_.count()));
     }
-  
+
   wire_.encode();
-  return wire_;    
+  return wire_;
 }
-  
-inline void 
+
+inline void
 ForwardingEntry::wireDecode(const Block &wire)
 {
   action_.clear();
   prefix_.clear();
   faceId_ = -1;
   forwardingFlags_ = ForwardingFlags();
-  freshnessPeriod_ = -1;
+  freshnessPeriod_ = time::milliseconds::min();
 
   wire_ = wire;
   wire_.parse();
@@ -185,7 +185,7 @@
   val = wire_.find(Tlv::FreshnessPeriod);
   if (val != wire_.elements_end())
     {
-      freshnessPeriod_ = readNonNegativeInteger(*val);
+      freshnessPeriod_ = time::milliseconds(readNonNegativeInteger(*val));
     }
 }
 
@@ -193,7 +193,7 @@
 operator << (std::ostream &os, const ForwardingEntry &entry)
 {
   os << "ForwardingEntry(";
-  
+
   // Action
   if (!entry.getAction().empty())
     {
@@ -213,7 +213,7 @@
   os << "ForwardingFlags:" << entry.getForwardingFlags() << ", ";
 
   // FreshnessPeriod
-  if (entry.getFreshnessPeriod() >= 0)
+  if (entry.getFreshnessPeriod() >= time::milliseconds::zero())
     {
       os << "FreshnessPeriod:" << entry.getFreshnessPeriod() << ", ";
     }