mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
Date.timeFunc
This commit is contained in:
parent
5622e758fa
commit
0c15cfb0ce
@ -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() + "\"";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user