[Ns-developers] Different Clocks

Lalith Suresh suresh.lalith at gmail.com
Wed Mar 21 02:30:46 PDT 2012

On Wed, Mar 21, 2012 at 10:20 AM, Mike Moreton <mjvm_ns at hotmail.com> wrote:
> One of the problems that real world protocols have to contend with is that different nodes may have slightly different speed clocks - no two crystals are ever exactly the same.  You can get beating effects where everything runs fine for a while, and then at some point suddenly a whole load of things happen at once, and something goes wrong.
> Is there any way of simulating this with NS?  As fas as I can see NS-3 has one global view of "time".

I once had a need of simulating an application which runs on many
nodes that had to have a different 'local time'. I did this by using
Simulator::Now() - <some delta> as the time within the application. I
assumed that there was no drift (which isn't a realistic assumption
either, but sufficed for my small scenario).

But I don't know any elegant way of doing this through every component
of the node. You could try modifying the simulator implementation's
::Now() method to offset the timestamp by a delta corresponding to
each node, but expect a significant performance drop. :)

Lalith Suresh

More information about the Ns-developers mailing list