NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
monotonic_deadline_timer.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NDN_UTIL_MONOTONIC_DEADLINE_TIMER_HPP
27 #define NDN_UTIL_MONOTONIC_DEADLINE_TIMER_HPP
28 
29 #include <boost/asio.hpp>
30 #include "time.hpp"
31 
32 namespace boost {
33 namespace asio {
34 
35 template<>
36 struct time_traits<ndn::time::steady_clock>
37 {
40 
41  static time_type
42  now()
43  {
45  }
46 
47  static time_type
48  add(const time_type& time, const duration_type& duration)
49  {
50  return time + duration;
51  }
52 
53  static duration_type
54  subtract(const time_type& timeLhs, const time_type& timeRhs)
55  {
56  return timeLhs - timeRhs;
57  }
58 
59  static bool
60  less_than(const time_type& timeLhs, const time_type& timeRhs)
61  {
62  return timeLhs < timeRhs;
63  }
64 
65  static boost::posix_time::time_duration
66  to_posix_duration(const duration_type& duration)
67  {
68  return ndn::time::steady_clock::to_posix_duration(duration);
69  }
70 };
71 
72 } // namespace asio
73 } // namespace boost
74 
75 namespace ndn {
76 
77 typedef boost::asio::basic_deadline_timer<time::steady_clock> monotonic_deadline_timer;
78 
79 } // namespace ndn
80 
81 #endif // NDN_UTIL_MONOTONIC_DEADLINE_TIMER_HPP
time_point TimePoint
Definition: time.hpp:108
Copyright (c) 2011-2015 Regents of the University of California.
Copyright (c) 2013-2015 Regents of the University of California.
static boost::posix_time::time_duration to_posix_duration(const duration_type &duration)
static time_point now() noexcept
Definition: time.cpp:79
static time_type add(const time_type &time, const duration_type &duration)
Steady clock.
Definition: time.hpp:99
static duration_type subtract(const time_type &timeLhs, const time_type &timeRhs)
boost::asio::basic_deadline_timer< time::steady_clock > monotonic_deadline_timer
static bool less_than(const time_type &timeLhs, const time_type &timeRhs)