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/meta-info.hpp b/src/meta-info.hpp
index 2bccd37..42875d8 100644
--- a/src/meta-info.hpp
+++ b/src/meta-info.hpp
@@ -22,11 +22,11 @@
     TYPE_LINK = 1,
     TYPE_KEY = 2
   };
-  
+
   MetaInfo()
     : m_type(TYPE_DEFAULT)
     , m_freshnessPeriod(-1)
-  {   
+  {
   }
 
   MetaInfo(const Block& block)
@@ -38,21 +38,21 @@
   size_t
   wireEncode(EncodingImpl<T> &block) const;
 
-  const Block& 
+  const Block&
   wireEncode() const;
-  
+
   void
-  wireDecode(const Block &wire);  
-  
+  wireDecode(const Block &wire);
+
   ///////////////////////////////////////////////////////////////////////////////
   // Getters/setters
-  
-  uint32_t 
+
+  uint32_t
   getType() const
   {
     return m_type;
   }
-  
+
   MetaInfo&
   setType(uint32_t type)
   {
@@ -60,15 +60,15 @@
     m_type = type;
     return *this;
   }
-  
-  Milliseconds 
+
+  const time::milliseconds&
   getFreshnessPeriod() const
   {
     return m_freshnessPeriod;
   }
-  
+
   MetaInfo&
-  setFreshnessPeriod(Milliseconds freshnessPeriod)
+  setFreshnessPeriod(const time::milliseconds& freshnessPeriod)
   {
     m_wire.reset();
     m_freshnessPeriod = freshnessPeriod;
@@ -88,10 +88,10 @@
     m_finalBlockId = finalBlockId;
     return *this;
   }
-  
+
 private:
   uint32_t m_type;
-  Milliseconds m_freshnessPeriod;
+  time::milliseconds m_freshnessPeriod;
   name::Component m_finalBlockId;
 
   mutable Block m_wire;
@@ -105,7 +105,7 @@
   //                ContentType?
   //                FreshnessPeriod?
   //                FinalBlockId?
-  
+
   size_t total_len = 0;
 
   // FinalBlockId
@@ -113,11 +113,12 @@
     {
       total_len += prependNestedBlock(blk, Tlv::FinalBlockId, m_finalBlockId);
     }
-  
+
   // FreshnessPeriod
-  if (m_freshnessPeriod >= 0)
+  if (m_freshnessPeriod >= time::milliseconds::zero())
     {
-      total_len += prependNonNegativeIntegerBlock(blk, Tlv::FreshnessPeriod, m_freshnessPeriod);
+      total_len += prependNonNegativeIntegerBlock(blk, Tlv::FreshnessPeriod,
+                                                  m_freshnessPeriod.count());
     }
 
   // ContentType
@@ -131,7 +132,7 @@
   return total_len;
 }
 
-inline const Block& 
+inline const Block&
 MetaInfo::wireEncode() const
 {
   if (m_wire.hasWire ())
@@ -139,14 +140,14 @@
 
   EncodingEstimator estimator;
   size_t estimatedSize = wireEncode(estimator);
-  
+
   EncodingBuffer buffer(estimatedSize, 0);
   wireEncode(buffer);
 
   m_wire = buffer.block();
   return m_wire;
 }
-  
+
 inline void
 MetaInfo::wireDecode(const Block &wire)
 {
@@ -156,7 +157,7 @@
   // MetaInfo ::= META-INFO-TYPE TLV-LENGTH
   //                ContentType?
   //                FreshnessPeriod?
-  
+
   // ContentType
   Block::element_const_iterator val = m_wire.find(Tlv::ContentType);
   if (val != m_wire.elements().end())
@@ -170,10 +171,10 @@
   val = m_wire.find(Tlv::FreshnessPeriod);
   if (val != m_wire.elements().end())
     {
-      m_freshnessPeriod = readNonNegativeInteger(*val);
+      m_freshnessPeriod = time::milliseconds(readNonNegativeInteger(*val));
     }
   else
-    m_freshnessPeriod = -1;
+    m_freshnessPeriod = time::milliseconds::min();
 
   // FinalBlockId
   val = m_wire.find(Tlv::FinalBlockId);
@@ -197,7 +198,7 @@
   os << "ContentType: " << info.getType();
 
   // FreshnessPeriod
-  if (info.getFreshnessPeriod() >= 0) {
+  if (info.getFreshnessPeriod() >= time::milliseconds::zero()) {
     os << ", FreshnessPeriod: " << info.getFreshnessPeriod();
   }