home *** CD-ROM | disk | FTP | other *** search
- mbenneyTimer = function()
- {
- this.reset();
- };
- mT = mbenneyTimer.prototype;
- mT.reset = function()
- {
- this.oldTime = 0;
- this.pause = true;
- this.totalTime = 0;
- };
- mT.stop = function()
- {
- if(!this.pause)
- {
- this.pause = true;
- this.totalTime += getTimer() - this.oldTime;
- }
- };
- mT.start = function()
- {
- if(this.pause)
- {
- this.pause = false;
- this.oldTime = getTimer();
- }
- };
- mT.getMili = function()
- {
- var returnTime = this.totalTime;
- if(!this.pause)
- {
- returnTime += getTimer() - this.oldTime;
- }
- return returnTime;
- };
- mT.getSecs = function()
- {
- var returnTime = this.totalTime / 1000;
- if(!this.pause)
- {
- returnTime += (getTimer() - this.oldTime) / 1000;
- }
- return Math.round(returnTime);
- };
- mT.getMins = function()
- {
- var returnTime = this.totalTime / 1000;
- if(!this.pause)
- {
- returnTime += (getTimer() - this.oldTime) / 1000 / 60;
- }
- return Math.round(returnTime);
- };
- mT.getCount = function(secs)
- {
- var returnTime = this.totalTime;
- if(!this.pause)
- {
- returnTime += (getTimer() - this.oldTime) / 1000;
- }
- var count = secs - returnTime;
- return Math.round(count);
- };
-