Code tagged with timer

Timer

Posted by Jorden Mauro over 2 years ago
Timer class. Starts counting when an object is instantiated, but can be reset via a call to start_timer(). Elapsed time is extracted simply by calling the object name as if it were a function (operator())
class Timer{
public:
   Timer() { start=clock(); }
   ~Timer() {}
   void start_timer() { start=clock(); }
   double operator()() const
   {
      return (static_cast(clock()-start) / 
	      static_cast(CLOCKS_PER_SEC));
   }
private:
   clock_t start;
};
Language C++ / Tagged with timer, function object

PHP Execution Timer

Posted by Chad Humphries over 2 years ago / Source: http://snippets.bigtoach.com/snippet/timer/
PHP >= PHP 4.0.4

float timer([float start,[int num]])

sets a start timer and outputs another timer less start to num decimals.

 
Language PHP / Tagged with timer