[Ns-developers] Different Clocks

Gustavo Carneiro gjcarneiro at gmail.com
Wed Mar 21 04:02:25 PDT 2012


On Wed, Mar 21, 2012 at 10:54, Mike Moreton <mjvm_ns at hotmail.com> wrote:

>
> I guess another alternative would be to add a node specific delta for each
> call to Schedule(), and keep a global time.
>

The argument to Schedule is a time interval, not an absolute time, so I
think you shouldn't mess with Schedule, only with Now, like Lalith said.

You would mess with Schedule if there was a severe time drift, when
compared to the time interval values that Schedule handles.  This is very
unlikely in the real world.  Only if the Schedule() receives a very large
time interval value...



> However, I'm not sure what the effect on frame reception would be - you
> want all nodes to see the frame ending at the same real time.
>
> Sounds like a lot of opportunities to get things wrong!
>
> > From: suresh.lalith at gmail.com
> > Date: Wed, 21 Mar 2012 10:30:46 +0100
> > Subject: Re: [Ns-developers] Different Clocks
> > To: mjvm_ns at hotmail.com
> > CC: ns-developers at isi.edu
> >
> > 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
> > www.lalith.in
>
>



-- 
Gustavo J. A. M. Carneiro
INESC Porto, UTM, WiN, http://win.inescporto.pt/gjc
"The universe is always one step beyond logic." -- Frank Herbert



More information about the Ns-developers mailing list