Posted By

marcocs on 09/15/09


Tagged

time debug


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

sulfurito


Time Execution Javascript


 / Published in: JavaScript
 

Javascript time execution utility: Use:

var otd = new timeDebugger(); otd.start(); alert(otd.end());

  1. function timeDebugger() { };
  2.  
  3. timeDebugger.prototype.d = new Date();
  4. timeDebugger.prototype.t = new Date();
  5.  
  6. timeDebugger.prototype.start = function() {
  7. this.d = new Date();
  8. this.t = this.d.getTime();
  9. };
  10.  
  11. timeDebugger.prototype.end = function() {
  12. this.d = new Date();
  13. return (this.d.getTime() - this.t);
  14. };

Report this snippet  

You need to login to post a comment.