Previous Tip  |  Next Tip  |  Design Tips   | [Bill's Home]

136. Showing uptime

The wireless access point (AP) emulator has an uptime on many of the generated pages. This must show the difference in time between the time that the AP was started and the current time. For example try a few screens:

This is achieved with the intial setting of:

 

var start=new Date();


sec_start=start.gettime();

 

 

and then the function getuptime() is called every time that the
uptime is required:

 

textmsg[0]=" AP1200-bf98f8 [Cisco 1200 Series AP 11.40T] Uptime: " + getuptime() + "<BR><BR>___________________________________<BR>Associations<BR> [Clnts: 0] of 0 [Rptrs: 0] of 0 [Brdgs: 0] of 0 [APs]: 1<BR>___________________________________<BR>Events<BR> Time Severity Description <BR>___________________________________<BR>Network Ports ===[Diagnostics]===<BR> Device Status Mb/s IP Addr. MAC Addr.<BR>[Ethernet] No Link 0.0 " + ipaddress + " 0009b7bf98f8<BR>[AP Radio] Up 11.0 " + ipaddress + " 0009b7bf98f8<BR><BR>___________________________________<BR>";


function getuptime()
{
dat= new Date();

sec_now=dat.getTime();

dat.setTime(sec_now-sec_start);

hr=dat.getHours();
min=dat.getMinutes();
sec=dat.getSeconds();
return(hr.toString() + ":" + min.toString() + ":" + sec.toString());
}

 

 

and then the function getuptime() is called every time that the uptime is required: