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 "time.hpp"
30 
31 #include <boost/asio/basic_deadline_timer.hpp>
32 
33 namespace boost {
34 namespace asio {
35 
36 template<>
37 struct time_traits<ndn::time::steady_clock>
38 {
41 
42  static time_type
43  now()
44  {
46  }
47 
48  static time_type
49  add(const time_type& time, const duration_type& duration)
50  {
51  return time + duration;
52  }
53 
54  static duration_type
55  subtract(const time_type& timeLhs, const time_type& timeRhs)
56  {
57  return timeLhs - timeRhs;
58  }
59 
60  static bool
61  less_than(const time_type& timeLhs, const time_type& timeRhs)
62  {
63  return timeLhs < timeRhs;
64  }
65 
66  static boost::posix_time::time_duration
67  to_posix_duration(const duration_type& duration)
68  {
69  return ndn::time::steady_clock::to_posix_duration(duration);
70  }
71 };
72 
73 } // namespace asio
74 } // namespace boost
75 
76 namespace ndn {
77 
78 typedef boost::asio::basic_deadline_timer<time::steady_clock> monotonic_deadline_timer;
79 
80 } // namespace ndn
81 
82 #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)