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/nfd-status.hpp b/src/management/nfd-status.hpp
index fa7f884..e00c705 100644
--- a/src/management/nfd-status.hpp
+++ b/src/management/nfd-status.hpp
@@ -44,8 +44,6 @@
   wireDecode(const Block& payload);
 
 public:
-  typedef boost::chrono::time_point<boost::chrono::system_clock, boost::chrono::seconds> Timestamp;
-
   int
   getNfdVersion() const
   {
@@ -58,26 +56,26 @@
     m_nfdVersion = nfdVersion;
   }
 
-  Timestamp
+  const time::system_clock::TimePoint&
   getStartTimestamp() const
   {
     return m_startTimestamp;
   }
 
   void
-  setStartTimestamp(Timestamp startTimestamp)
+  setStartTimestamp(const time::system_clock::TimePoint& startTimestamp)
   {
     m_startTimestamp = startTimestamp;
   }
 
-  Timestamp
+  const time::system_clock::TimePoint&
   getCurrentTimestamp() const
   {
     return m_currentTimestamp;
   }
 
   void
-  setCurrentTimestamp(Timestamp currentTimestamp)
+  setCurrentTimestamp(const time::system_clock::TimePoint& currentTimestamp)
   {
     m_currentTimestamp = currentTimestamp;
   }
@@ -192,8 +190,8 @@
 
 private:
   int       m_nfdVersion;
-  Timestamp m_startTimestamp;
-  Timestamp m_currentTimestamp;
+  time::system_clock::TimePoint m_startTimestamp;
+  time::system_clock::TimePoint m_currentTimestamp;
   size_t    m_nNameTreeEntries;
   size_t    m_nFibEntries;
   size_t    m_nPitEntries;
@@ -205,24 +203,22 @@
   int       m_nOutDatas;
 };
 
-BOOST_STATIC_ASSERT((boost::is_same<Status::Timestamp::period, boost::ratio<1> >::value));
-
 inline
 Status::Status()
-{
-  m_nfdVersion = 0;
-  m_startTimestamp = Timestamp::min();
-  m_currentTimestamp = Timestamp::min();
-  m_nNameTreeEntries = 0;
-  m_nFibEntries = 0;
-  m_nPitEntries = 0;
-  m_nMeasurementsEntries = 0;
-  m_nCsEntries = 0;
-  m_nInInterests = 0;
-  m_nOutInterests = 0;
-  m_nInDatas = 0;
-  m_nOutDatas = 0;
-}
+  : m_nfdVersion(0)
+  , m_startTimestamp(time::system_clock::TimePoint::min())
+  , m_currentTimestamp(time::system_clock::TimePoint::min())
+  , m_nNameTreeEntries(0)
+  , m_nFibEntries(0)
+  , m_nPitEntries(0)
+  , m_nMeasurementsEntries(0)
+  , m_nCsEntries(0)
+  , m_nInInterests(0)
+  , m_nOutInterests(0)
+  , m_nInDatas(0)
+  , m_nOutDatas(0)
+  {
+  }
 
 template<bool T>
 inline size_t
@@ -249,9 +245,9 @@
   total_len += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NNameTreeEntries,
                                               m_nNameTreeEntries);
   total_len += prependNonNegativeIntegerBlock(encoder, tlv::nfd::CurrentTimestamp,
-               m_currentTimestamp.time_since_epoch().count());
+                                              time::toUnixTimestamp(m_currentTimestamp).count());
   total_len += prependNonNegativeIntegerBlock(encoder, tlv::nfd::StartTimestamp,
-               m_startTimestamp.time_since_epoch().count());
+                                              time::toUnixTimestamp(m_startTimestamp).count());
   total_len += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NfdVersion,
                                               m_nfdVersion);
 
@@ -262,8 +258,8 @@
 Status::wireDecode(const Block& payload)
 {
   m_nfdVersion = 0;
-  m_startTimestamp = Timestamp::min();
-  m_currentTimestamp = Timestamp::min();
+  m_startTimestamp = time::system_clock::TimePoint::min();
+  m_currentTimestamp = time::system_clock::TimePoint::min();
   m_nNameTreeEntries = 0;
   m_nFibEntries = 0;
   m_nPitEntries = 0;
@@ -288,12 +284,12 @@
 
   val = payload.find(tlv::nfd::StartTimestamp);
   if (val != payload.elements_end()) {
-    m_startTimestamp = Timestamp(boost::chrono::seconds(readNonNegativeInteger(*val)));
+    m_startTimestamp = time::fromUnixTimestamp(time::milliseconds(readNonNegativeInteger(*val)));
   }
 
   val = payload.find(tlv::nfd::CurrentTimestamp);
   if (val != payload.elements_end()) {
-    m_currentTimestamp = Timestamp(boost::chrono::seconds(readNonNegativeInteger(*val)));
+    m_currentTimestamp = time::fromUnixTimestamp(time::milliseconds(readNonNegativeInteger(*val)));
   }
 
   val = payload.find(tlv::nfd::NNameTreeEntries);