util: switch to boost::asio::basic_waitable_timer

Change-Id: I2724befc86482adf84f59063e65509a116bb1b46
Refs: #4431
diff --git a/src/util/detail/monotonic-deadline-timer.hpp b/src/util/detail/monotonic-deadline-timer.hpp
deleted file mode 100644
index 002912c..0000000
--- a/src/util/detail/monotonic-deadline-timer.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-/**
- * This code is based on https://svn.boost.org/trac/boost/attachment/ticket/3504/MonotonicDeadlineTimer.h
- */
-
-#ifndef NDN_UTIL_DETAIL_MONOTONIC_DEADLINE_TIMER_HPP
-#define NDN_UTIL_DETAIL_MONOTONIC_DEADLINE_TIMER_HPP
-
-#include "../time.hpp"
-#include <boost/asio/basic_deadline_timer.hpp>
-#include <boost/asio/io_service.hpp>
-
-namespace boost {
-namespace asio {
-
-template<>
-struct time_traits<ndn::time::steady_clock>
-{
-  using time_type     = ndn::time::steady_clock::TimePoint;
-  using duration_type = ndn::time::steady_clock::Duration;
-
-  static time_type
-  now()
-  {
-    return ndn::time::steady_clock::now();
-  }
-
-  static time_type
-  add(const time_type& time, const duration_type& duration)
-  {
-    return time + duration;
-  }
-
-  static duration_type
-  subtract(const time_type& timeLhs, const time_type& timeRhs)
-  {
-    return timeLhs - timeRhs;
-  }
-
-  static bool
-  less_than(const time_type& timeLhs, const time_type& timeRhs)
-  {
-    return timeLhs < timeRhs;
-  }
-
-  static boost::posix_time::time_duration
-  to_posix_duration(const duration_type& duration)
-  {
-    return ndn::time::steady_clock::to_posix_duration(duration);
-  }
-};
-
-} // namespace asio
-} // namespace boost
-
-namespace ndn {
-namespace util {
-namespace detail {
-
-class MonotonicDeadlineTimer : public boost::asio::basic_deadline_timer<time::steady_clock>
-{
-public:
-  MonotonicDeadlineTimer(boost::asio::io_service& ioService)
-    : boost::asio::basic_deadline_timer<time::steady_clock>(ioService)
-  {
-  }
-};
-
-} // namespace detail
-} // namespace util
-} // namespace ndn
-
-#endif // NDN_UTIL_DETAIL_MONOTONIC_DEADLINE_TIMER_HPP
diff --git a/src/util/detail/steady-timer.hpp b/src/util/detail/steady-timer.hpp
new file mode 100644
index 0000000..4fb4e27
--- /dev/null
+++ b/src/util/detail/steady-timer.hpp
@@ -0,0 +1,60 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_UTIL_DETAIL_STEADY_TIMER_HPP
+#define NDN_UTIL_DETAIL_STEADY_TIMER_HPP
+
+#include "../time.hpp"
+
+#include <boost/asio/basic_waitable_timer.hpp>
+#include <boost/asio/wait_traits.hpp>
+
+namespace boost {
+namespace asio {
+
+template<>
+struct wait_traits<ndn::time::steady_clock>
+{
+  static ndn::time::steady_clock::duration
+  to_wait_duration(const ndn::time::steady_clock::duration& d)
+  {
+    return ndn::time::steady_clock::to_wait_duration(d);
+  }
+};
+
+} // namespace asio
+} // namespace boost
+
+namespace ndn {
+namespace util {
+namespace detail {
+
+class SteadyTimer : public boost::asio::basic_waitable_timer<time::steady_clock>
+{
+public:
+  using boost::asio::basic_waitable_timer<time::steady_clock>::basic_waitable_timer;
+};
+
+} // namespace detail
+} // namespace util
+} // namespace ndn
+
+#endif // NDN_UTIL_DETAIL_STEADY_TIMER_HPP