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/face.cpp b/src/face.cpp
index fe509c4..aec1cdf 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -65,8 +65,8 @@
   m_transport = transport;
   m_ioService = ioService;
 
-  m_pitTimeoutCheckTimer      = make_shared<boost::asio::deadline_timer>(boost::ref(*m_ioService));
-  m_processEventsTimeoutTimer = make_shared<boost::asio::deadline_timer>(boost::ref(*m_ioService));
+  m_pitTimeoutCheckTimer      = make_shared<monotonic_deadline_timer>(boost::ref(*m_ioService));
+  m_processEventsTimeoutTimer = make_shared<monotonic_deadline_timer>(boost::ref(*m_ioService));
 
   if (std::getenv("NFD") != 0)
     {
@@ -132,7 +132,7 @@
 
   if (!m_pitTimeoutCheckTimerActive) {
     m_pitTimeoutCheckTimerActive = true;
-    m_pitTimeoutCheckTimer->expires_from_now(boost::posix_time::milliseconds(100));
+    m_pitTimeoutCheckTimer->expires_from_now(time::milliseconds(100));
     m_pitTimeoutCheckTimer->async_wait(bind(&Face::checkPitExpire, this));
   }
 }
@@ -218,20 +218,21 @@
 }
 
 void
-Face::processEvents(Milliseconds timeout/* = 0 */, bool keepThread/* = false*/)
+Face::processEvents(const time::milliseconds& timeout/* = time::milliseconds::zero()*/,
+                    bool keepThread/* = false*/)
 {
   try
     {
-      if (timeout < 0)
+      if (timeout < time::milliseconds::zero())
         {
           // do not block if timeout is negative, but process pending events
           m_ioService->poll();
           return;
         }
 
-      if (timeout > 0)
+      if (timeout > time::milliseconds::zero())
         {
-          m_processEventsTimeoutTimer->expires_from_now(boost::posix_time::milliseconds(timeout));
+          m_processEventsTimeoutTimer->expires_from_now(time::milliseconds(timeout));
           m_processEventsTimeoutTimer->async_wait(&fireProcessEventsTimeout);
         }
 
@@ -279,13 +280,13 @@
 void
 Face::checkPitExpire()
 {
-  // Check for PIT entry timeouts.  Go backwards through the list so we can erase entries.
-  MillisecondsSince1970 nowMilliseconds = getNowMilliseconds();
+  // Check for PIT entry timeouts.
+  time::steady_clock::TimePoint now = time::steady_clock::now();
 
   PendingInterestTable::iterator i = m_pendingInterestTable.begin();
   while (i != m_pendingInterestTable.end())
     {
-      if ((*i)->isTimedOut(nowMilliseconds))
+      if ((*i)->isTimedOut(now))
         {
           // Save the PendingInterest and remove it from the PIT.  Then call the callback.
           shared_ptr<PendingInterest> pendingInterest = *i;
@@ -301,7 +302,7 @@
   if (!m_pendingInterestTable.empty()) {
     m_pitTimeoutCheckTimerActive = true;
 
-    m_pitTimeoutCheckTimer->expires_from_now(boost::posix_time::milliseconds(100));
+    m_pitTimeoutCheckTimer->expires_from_now(time::milliseconds(100));
     m_pitTimeoutCheckTimer->async_wait(bind(&Face::checkPitExpire, this));
   }
   else {