tools: fix compilation with Boost 1.67

Change-Id: I0f4bae23f26eca07044990ce6dd01da750cfb569
Refs: #4584
diff --git a/tools/ndnsec/cert-dump.cpp b/tools/ndnsec/cert-dump.cpp
index e0b99b4..39d5baf 100644
--- a/tools/ndnsec/cert-dump.cpp
+++ b/tools/ndnsec/cert-dump.cpp
@@ -22,7 +22,9 @@
 #include "ndnsec.hpp"
 #include "util.hpp"
 
+#if BOOST_VERSION < 106700
 #include <boost/date_time/posix_time/posix_time_duration.hpp>
+#endif // BOOST_VERSION < 106700
 
 namespace ndn {
 namespace ndnsec {
@@ -173,9 +175,12 @@
       return 0;
     }
     if (isRepoOut) {
-      using namespace boost::asio::ip;
-      tcp::iostream requestStream;
+      boost::asio::ip::tcp::iostream requestStream;
+#if BOOST_VERSION >= 106700
+      requestStream.expires_after(std::chrono::seconds(3));
+#else
       requestStream.expires_from_now(boost::posix_time::seconds(3));
+#endif // BOOST_VERSION >= 106700
       requestStream.connect(repoHost, repoPort);
       if (!requestStream) {
         std::cerr << "fail to open the stream!" << std::endl;
diff --git a/tools/ndnsec/cert-install.cpp b/tools/ndnsec/cert-install.cpp
index e83f41b..3ae6724 100644
--- a/tools/ndnsec/cert-install.cpp
+++ b/tools/ndnsec/cert-install.cpp
@@ -22,7 +22,9 @@
 #include "ndnsec.hpp"
 #include "util.hpp"
 
+#if BOOST_VERSION < 106700
 #include <boost/date_time/posix_time/posix_time_duration.hpp>
+#endif // BOOST_VERSION < 106700
 
 namespace ndn {
 namespace ndnsec {
@@ -40,14 +42,18 @@
 security::v2::Certificate
 getCertificateHttp(const std::string& host, const std::string& port, const std::string& path)
 {
-  using namespace boost::asio::ip;
-
-  tcp::iostream requestStream;
+  boost::asio::ip::tcp::iostream requestStream;
+#if BOOST_VERSION >= 106700
+  requestStream.expires_after(std::chrono::seconds(3));
+#else
   requestStream.expires_from_now(boost::posix_time::seconds(3));
+#endif // BOOST_VERSION >= 106700
+
   requestStream.connect(host, port);
   if (!requestStream) {
     BOOST_THROW_EXCEPTION(HttpException("HTTP connection error"));
   }
+
   requestStream << "GET " << path << " HTTP/1.0\r\n";
   requestStream << "Host: " << host << "\r\n";
   requestStream << "Accept: */*\r\n";