time-custom-clock.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_TIME_CUSTOM_CLOCK_HPP
23 #define NDN_TIME_CUSTOM_CLOCK_HPP
24 
25 #include "time.hpp"
26 
27 namespace ndn {
28 namespace time {
29 
36 template<typename BaseClock>
38 {
39 public:
40  virtual
41  ~CustomClock() = default;
42 
43  virtual typename BaseClock::time_point
44  getNow() const = 0;
45 
46  virtual std::string
47  getSince() const = 0;
48 
49  virtual boost::posix_time::time_duration
50  toPosixDuration(const typename BaseClock::duration& duration) const = 0;
51 };
52 
55 
62 void
63 setCustomClocks(shared_ptr<CustomSteadyClock> steadyClock = nullptr,
64  shared_ptr<CustomSystemClock> systemClock = nullptr);
65 
66 } // namespace time
67 } // namespace ndn
68 
69 #endif // NDN_TIME_CUSTOM_CLOCK_HPP
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:66
virtual BaseClock::time_point getNow() const =0
CustomClock< steady_clock > CustomSteadyClock
virtual std::string getSince() const =0
Class implementing custom system or steady clock behavior.
CustomClock< system_clock > CustomSystemClock
virtual boost::posix_time::time_duration toPosixDuration(const typename BaseClock::duration &duration) const =0
void setCustomClocks(shared_ptr< CustomSteadyClock > steadyClock=nullptr, shared_ptr< CustomSystemClock > systemClock=nullptr)
Set custom system and steady clocks.
Definition: time.cpp:36
virtual ~CustomClock()=default