#ifndef CLOCK_H #define CLOCK_H #include "ns3/object.h" #include "ns3/nstime.h" namespace ns3 { class Clock: public Object { public: /** * \brief Get the TypeId * * \return The TypeId for this class */ static TypeId GetTypeId(); /** * \brief Create a Clock */ Clock(); /** * Destroy a Clock * * This is the destructor for the Clock. */ ~Clock(); // Delete copy constructor and assignment operator to avoid misuse Clock& operator=(const Clock&) = delete; Clock(const Clock&) = delete; void AddClockCorrectionCallback(Callback cb); void TriggerCorrectionCallback(); virtual Time GetLocalTime(); virtual Time GetUncorrectedLocalTime(); /** * * \brief Get Clock time at instant t in the simulator/perfect time base * * \params t Timestamp in the simulator/perfect time base * \return clock time at instant t */ virtual Time GetTimeAt(Time t); /** * * \brief Get duration in the clock timebase from duration in the simulator/perfect time base * * \params d duration in the simulator/perfect time base * \return duration in the clock timebase */ virtual Time GetDuration(Time d); virtual void UpdateTime(); void SetOffsetTime(Time offset); protected: Time m_correctionOffset = Time(0); Time m_granularity; private: std::vector> m_callbacks; }; } #endif /* CLOCK_H */