[ns] Example of Simple Timer
Mubashir Rehmani
mshrehmani at gmail.com
Mon Sep 8 00:03:45 PDT 2008
Hi Scott Novich
Here is the example of simple timer
*Declare this timer in the header fil**e*
class MyTimer : public TimerHandler {
public:
MyTimer(AODV* ms) : TimerHandler() {ms_=ms;};
protected:
virtual void expire(Event* e);
AODV* ms_;
};
MyTimer MS_timer_;
*Declare in the .cc file *
void MyTimer::expire(Event*) {
if(check==0)
{
ms_->MS_timer_.resched(10); //delay of 10 seconds
cout<<"time is : "<<Scheduler::instance().clock()<<endl;
//call any function which you want to schedule....
}
}
Hope it satisfies your needs.
Regards
--
Mubashir Husain Rehmani
Mobile : 00 33 (0)6 32 00 89 35
More information about the Ns-users
mailing list