0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

Date.timeFunc

This commit is contained in:
Eliot Horowitz 2009-01-27 14:27:41 -05:00
parent 5622e758fa
commit 0c15cfb0ce

View File

@ -45,6 +45,18 @@ String.prototype.rtrim = function() {
return this.replace(/\s+$/,"");
}
Date.timeFunc = function( theFunc , numTimes ){
var start = new Date();
numTimes = numTimes || 1;
for ( var i=0; i<numTimes; i++ ){
theFunc.apply( null , argumentsToArray( arguments ).slice( 2 ) );
}
return (new Date()).getTime() - start.getTime();
}
Date.prototype.tojson = function(){
return "\"" + this.toString() + "\"";
}