core: global io_service and scheduler
Scheduler and time are imported from ndn-cpp-dev.
Forwarder is using the new scheduler API.
Face system is not transitioned yet.
refs #1290
Change-Id: I5679cb50bbf9890a105f663b038f13951403c2b6
diff --git a/daemon/core/time.hpp b/daemon/core/time.hpp
index 5efd082..2c9498f 100644
--- a/daemon/core/time.hpp
+++ b/daemon/core/time.hpp
@@ -8,152 +8,19 @@
#define NFD_CORE_TIME_H
#include "common.hpp"
+#include <ndn-cpp-dev/util/time.hpp>
namespace nfd {
namespace time {
-class monotonic_clock;
-
-/** \class Duration
- * \brief represents a time interval
- * Time unit is nanosecond.
- */
-class Duration
-{
-public:
- Duration()
- : m_value(0)
- {
- }
-
- explicit
- Duration(int64_t value)
- : m_value(value)
- {
- }
-
- operator int64_t&()
- {
- return m_value;
- }
-
- operator const int64_t&() const
- {
- return m_value;
- }
-
- Duration
- operator+(const Duration& other) const
- {
- return Duration(this->m_value + other.m_value);
- }
-
- Duration
- operator-(const Duration& other) const
- {
- return Duration(this->m_value - other.m_value);
- }
-
-private:
- int64_t m_value;
-};
-
-/** \class Point
- * \brief represents a point in time
- * This uses monotonic clock.
- */
-class Point
-{
-public:
- Point()
- : m_value(0)
- {
- }
-
- explicit
- Point(int64_t value)
- : m_value(value)
- {
- }
-
- operator int64_t&()
- {
- return m_value;
- }
-
- operator const int64_t&() const
- {
- return m_value;
- }
-
- Point
- operator+(const Duration& other) const
- {
- return Point(this->m_value + static_cast<int64_t>(other));
- }
-
- Duration
- operator-(const Point& other) const
- {
- return Duration(this->m_value - other.m_value);
- }
-
- Point
- operator-(const Duration& other) const
- {
- return Point(this->m_value - static_cast<int64_t>(other));
- }
-
-private:
- int64_t m_value;
-};
-
-/**
- * \brief Get current time
- * \return{ the current time in monotonic clock }
- */
-Point
-now();
-
-/**
- * \brief Get time::Duration for the specified number of seconds
- */
-template<class T>
-inline Duration
-seconds(T value)
-{
- return Duration(value * static_cast<int64_t>(1000000000));
-}
-
-/**
- * \brief Get time::Duration for the specified number of milliseconds
- */
-template<class T>
-inline Duration
-milliseconds(T value)
-{
- return Duration(value * static_cast<int64_t>(1000000));
-}
-
-/**
- * \brief Get time::Duration for the specified number of microseconds
- */
-template<class T>
-inline Duration
-microseconds(T value)
-{
- return Duration(value * static_cast<int64_t>(1000));
-}
-
-/**
- * \brief Get time::Duration for the specified number of nanoseconds
- */
-inline Duration
-nanoseconds(int64_t value)
-{
- return Duration(value);
-}
-
+using ndn::time::Duration;
+using ndn::time::Point;
+using ndn::time::monotonic_clock;
+using ndn::time::now;
+using ndn::time::seconds;
+using ndn::time::milliseconds;
+using ndn::time::microseconds;
+using ndn::time::nanoseconds;
} // namespace time
} // namespace nfd