core: Basic implementation of Scheduler

refs #1119 (http://redmine.named-data.net/issues/1119)

Change-Id: I1783857452941794a2538534d3492d30ac58dd25
diff --git a/daemon/core/time.hpp b/daemon/core/time.hpp
index 1299ab4..3b0d002 100644
--- a/daemon/core/time.hpp
+++ b/daemon/core/time.hpp
@@ -12,22 +12,149 @@
 namespace ndn {
 namespace time {
 
+class monotonic_clock;
+
 /** \class Duration
  *  \brief represents a time interval
  *  Time unit is nanosecond.
  */
-typedef int64_t Duration;
+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.
  */
-typedef Duration Point;
+class Point
+{
+public:
+  Point()
+    : m_value(0)
+  {
+  }
 
-/// \return{ the current time in monotonic clock }
+  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);
+}
+
+
 } // namespace time
 } // namespace ndn