From 5b47785ae47e2e60d9fe760392dafe96f8544d9a Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 14 Nov 2007 13:45:17 +0100 Subject: [PATCH] add a ns3::MaxSeconds function --- src/simulator/nstime.h | 6 ++++++ src/simulator/time.cc | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/simulator/nstime.h b/src/simulator/nstime.h index 6b6660f70..24d7fd671 100644 --- a/src/simulator/nstime.h +++ b/src/simulator/nstime.h @@ -577,6 +577,12 @@ Time PicoSeconds (uint64_t ps); */ Time FemtoSeconds (uint64_t fs); +/** + * \brief create a ns3::Time instance which represents + * the maximum value representable in a simulation. + */ +Time MaxSeconds (void); + // internal function not publicly documented Time TimeStep (uint64_t ts); diff --git a/src/simulator/time.cc b/src/simulator/time.cc index a58a54925..8751cc4d4 100644 --- a/src/simulator/time.cc +++ b/src/simulator/time.cc @@ -268,6 +268,12 @@ Time FemtoSeconds (uint64_t fs) uint64_t ts = TimeUnit<1>::UnitsToTimestep(fs, TimeStepPrecision::FS_FACTOR); return TimeStep(ts); } +Time MaxSeconds (void) +{ + // XXX: I am fairly certain other compilers use other non-standard + // post-fixes to indicate 64 bit constants. + return TimeStep (0xffffffffffffffffLL); +} /* * The timestep value passed to this function must be of the precision