.netにある、処理時間を測定するためのStopWatchクラス。
StopWatch = function () { this.nTime = 0; };
StopWatch.prototype = {
start : function(){ this.startTime = new Date(); },
stop : function(){ this.nTime += (new Date()) - this.startTime; },
clear : function(){ this.nTime = 0; },
getTime: function(){ return this.nTime; }
};
// Test
var sw = new StopWatch();
sw.start(); WScript.sleep(1000); sw.stop();
WScript.echo( sw.getTime() );