65 lines
1.4 KiB
C
65 lines
1.4 KiB
C
|
|
#ifndef FIXPRECISIONCLOCK_H
|
||
|
|
#define FIXPRECISIONCLOCK_H
|
||
|
|
|
||
|
|
#include "ns3/object.h"
|
||
|
|
#include "ns3/nstime.h"
|
||
|
|
|
||
|
|
#include "ns3/clock.h"
|
||
|
|
|
||
|
|
namespace ns3
|
||
|
|
{
|
||
|
|
|
||
|
|
/**
|
||
|
|
* \ingroup tsn
|
||
|
|
* \brief Clock with fix precision.
|
||
|
|
*
|
||
|
|
* This class represents a non realistic clock that have a fix precision
|
||
|
|
* according to the grandmaster time base. It is only use to research purpose
|
||
|
|
* (search of the worst case scenario)
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
class FixPrecisionClock: public Clock
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
/**
|
||
|
|
* \brief Get the TypeId
|
||
|
|
*
|
||
|
|
* \return The TypeId for this class
|
||
|
|
*/
|
||
|
|
static TypeId GetTypeId();
|
||
|
|
|
||
|
|
/**
|
||
|
|
* \brief Create a FixPrecisionClock
|
||
|
|
*/
|
||
|
|
FixPrecisionClock();
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Destroy a FixPrecisionClock
|
||
|
|
*
|
||
|
|
* This is the destructor for the FixPrecisionClock.
|
||
|
|
*/
|
||
|
|
~FixPrecisionClock() override;
|
||
|
|
|
||
|
|
// Delete copy constructor and assignment operator to avoid misuse
|
||
|
|
FixPrecisionClock& operator=(const FixPrecisionClock&) = delete;
|
||
|
|
FixPrecisionClock(const FixPrecisionClock&) = delete;
|
||
|
|
|
||
|
|
Time GetLocalTime() override;
|
||
|
|
Time GetUncorrectedLocalTime() override;
|
||
|
|
Time GetTimeAt(Time t) override;
|
||
|
|
Time GetDuration(Time t) override;
|
||
|
|
|
||
|
|
void SetRefClock(Ptr<Clock> refClock);
|
||
|
|
|
||
|
|
|
||
|
|
protected:
|
||
|
|
|
||
|
|
private:
|
||
|
|
Time m_precision;
|
||
|
|
Ptr<Clock> m_refClock = nullptr;
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
}
|
||
|
|
#endif /* FIXPRECISIONCLOCK_H */
|