Timer helper


Helper offering the possibility of timing temporal durations. It is useful, for example, to know how long it takes to execute a process.


use \Temma\Utils\Timer as TµTimer;

// create timer
$timer = new TµTimer();
// timer started
// timer stopped
// display time in seconds
// resume timing (without losing elapsed time)
// stop and retrieve total time
$delai = $timer->stop()->getTime();

The timer can be reset at any time by calling the start() method.

The start(), stop() and resume() methods return the object instance. The getTime() method returns a decimal number corresponding to the seconds elapsed.