Update README and add contrib dir

This commit is contained in:
2025-12-01 15:56:02 +01:00
parent 1b80de2153
commit cd9ba93d58
150 changed files with 25563 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
#include "clock-virtual.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/uinteger.h"
#include <ns3/double.h>
namespace ns3
{
NS_LOG_COMPONENT_DEFINE("VirtualClock");
NS_OBJECT_ENSURE_REGISTERED(VirtualClock);
TypeId
VirtualClock::GetTypeId()
{
static TypeId tid =
TypeId("ns3::VirtualClock")
.SetParent<Clock>()
.SetGroupName("tsn")
.AddConstructor<VirtualClock>();
return tid;
}
VirtualClock::VirtualClock()
{
NS_LOG_FUNCTION(this);
}
VirtualClock::~VirtualClock()
{
NS_LOG_FUNCTION(this);
}
void
VirtualClock::SetRefClock(Ptr<Clock> refClock)
{
NS_LOG_FUNCTION(this);
m_refClock = refClock;
}
Time
VirtualClock::GetLocalTime()
{
NS_LOG_FUNCTION(this);
return GetUncorrectedLocalTime() + m_correctionOffset;
}
Time
VirtualClock::GetUncorrectedLocalTime()
{
NS_LOG_FUNCTION(this);
NS_ASSERT_MSG(m_refClock != nullptr,
"Reference clock no set using void VirtualClock::SetRefClock(Ptr<Clock> refClock)");
return m_refClock->GetUncorrectedLocalTime();
}
Time
VirtualClock::GetTimeAt(Time t)
{
NS_LOG_FUNCTION(this);
return m_correctionOffset + m_refClock->GetTimeAt(t);
}
Time
VirtualClock::GetDuration(Time d)
{
NS_LOG_FUNCTION(this);
return m_refClock->GetDuration(d);
}
}