utils: Enable use of the simulation time in NFD
Conversion of ndnSIM time to system_clock::time_point, steady_clock::time_point, so that NFD use the simulation time.
diff --git a/helper/ndn-stack-helper.cpp b/helper/ndn-stack-helper.cpp
index bd2413e..5d3dcd2 100644
--- a/helper/ndn-stack-helper.cpp
+++ b/helper/ndn-stack-helper.cpp
@@ -61,6 +61,8 @@
: m_limitsEnabled(false)
, m_needSetDefaultRoutes(false)
{
+ setCustomNdnCxxClocks();
+
m_ndnFactory.SetTypeId("ns3::ndn::L3Protocol");
m_strategyFactory.SetTypeId("ns3::ndn::fw::Flooding");
m_contentStoreFactory.SetTypeId("ns3::ndn::cs::Lru");
@@ -85,6 +87,13 @@
}
void
+StackHelper::setCustomNdnCxxClocks()
+{
+ ::ndn::time::setCustomClocks(make_shared<ns3::ndn::time::CustomSteadyClock>(),
+ make_shared<ns3::ndn::time::CustomSystemClock>());
+}
+
+void
StackHelper::SetStackAttributes(const std::string& attr1, const std::string& value1,
const std::string& attr2, const std::string& value2,
const std::string& attr3, const std::string& value3,
diff --git a/helper/ndn-stack-helper.hpp b/helper/ndn-stack-helper.hpp
index afc43dc..b6b4266 100644
--- a/helper/ndn-stack-helper.hpp
+++ b/helper/ndn-stack-helper.hpp
@@ -303,6 +303,10 @@
PointToPointNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
Ptr<NetDevice> netDevice) const;
+public:
+ void
+ setCustomNdnCxxClocks();
+
private:
StackHelper(const StackHelper&);
StackHelper&