From a762a51c47e0954661fab838a62be9365803bc4b Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Thu, 27 Aug 2015 23:24:02 +0200 Subject: [PATCH] Addition of Node::GetLocalTime to ease further development of the ns3 clock system --- src/network/model/node.cc | 7 +++++++ src/network/model/node.h | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/network/model/node.cc b/src/network/model/node.cc index 76684d8bfea..e8387a3adf0 100644 --- a/src/network/model/node.cc +++ b/src/network/model/node.cc @@ -110,6 +110,13 @@ Node::GetId (void) const return m_id; } +Time +Node::GetLocalTime(void) const +{ + NS_LOG_FUNCTION (this); + return Simulator::Now(); +} + uint32_t Node::GetSystemId (void) const { diff --git a/src/network/model/node.h b/src/network/model/node.h index 9826b6cd3de..d6175901fc8 100644 --- a/src/network/model/node.h +++ b/src/network/model/node.h @@ -33,6 +33,7 @@ namespace ns3 { class Application; class Packet; class Address; +class Time; /** @@ -77,6 +78,16 @@ class Node : public Object */ uint32_t GetId (void) const; + /** + * In the future, ns3 nodes may have clock that returned a local time + * different from the virtual time Simulator::Now(). + * This function is currently a placeholder to ease the development of this feature. + * For now, it is only an alias to Simulator::Now() + * + * \return The time as seen by this node + */ + Time GetLocalTime(void) const; + /** * \returns the system id for parallel simulations associated * to this node.