ns-allinone-2.35/wpan/p802_15_4timer.cc
void macWakeupTimer::start(void)
{
	double BI,bcnRxTime,now,wtime;
	double tmpf;
	BI = (aBaseSuperframeDuration * (1 << mac->macBeaconOrder2)) / mac->phy->getRate('s');
	bcnRxTime = mac->macBcnRxTime / mac->phy->getRate('s');
	now = CURRENT_TIME;
	while (now - bcnRxTime > BI)
	bcnRxTime += BI;
	{
		tmpf = (now - bcnRxTime);;
		wtime = BI - tmpf-aTurnaroundTime/mac->phy->getRate('s');
//		wtime=wtime-3*mac->csmaca->bPeriod;
		if (wtime < 0) {
			printf("WARNING: negative time for wakeup timer");
			abort();
		}
	}
	tmpf = now + wtime;
	lastTime = now + wtime;
	Mac802_15_4Timer::start(wtime);
}
// 2.31 change: Timer to control node shutdown and wakeup
2.31 change: Timer to control node shutdown and wakeup
2 . 31 change : Timer to control node shutdown and wakeup
void macWakeupTimer::start(void)
{
	double BI,bcnRxTime,now,wtime;
	double tmpf;
	BI = (aBaseSuperframeDuration * (1 << mac->macBeaconOrder2)) / mac->phy->getRate('s');
	bcnRxTime = mac->macBcnRxTime / mac->phy->getRate('s');
	now = CURRENT_TIME;
	while (now - bcnRxTime > BI)
	bcnRxTime += BI;
	{
		tmpf = (now - bcnRxTime);;
		wtime = BI - tmpf-aTurnaroundTime/mac->phy->getRate('s');
		if (wtime < 0) {
			printf("WARNING: negative time for wakeup timer");
			abort();
		}
	}
	tmpf = now + wtime;
	lastTime = now + wtime;
	Mac802_15_4Timer::start(wtime);
}
void macWakeupTimer :: start ( void ) { double BI , bcnRxTime , now , wtime ; double tmpf ; BI = ( aBaseSuperframeDuration * ( 1 << mac -> macBeaconOrder2 ) ) / mac -> phy -> getRate ( ' ' ) ; bcnRxTime = mac -> macBcnRxTime / mac -> phy -> getRate ( ' ' ) ; now = CURRENT_TIME ; while ( now - bcnRxTime > BI ) bcnRxTime += BI ; { tmpf = ( now - bcnRxTime ) ; ; wtime = BI - tmpf - aTurnaroundTime / mac -> phy -> getRate ( ' ' ) ; if ( wtime < 0 ) { printf ( " " ) ; abort ( ) ; } } tmpf = now + wtime ; lastTime = now + wtime ; Mac802_15_4Timer :: start ( wtime ) ; }
2.31 change: Timer to control node shutdown and wakeup
2 . 31 change : Timer to control node shutdown and wakeup
//		wtime=wtime-3*mac->csmaca->bPeriod;