dev-master
9999999-devSimple chrono
MIT
The Requires
- php >=7.2.0
time timer stopwatch chronometer chrono
Wallogit.com
2017 © Pedro PelĂĄez
Simple chrono
A collection of simple chronometers., (*1)
composer require pyrsmk/illuminator
Here's the base chrono., (*2)
$chrono = new Illuminator\Chrono(); // Start! $chrono->start(); // Stop the chrono for some time... $chrono->stop(); // Resume the chrono $chrono->start(); // Return the time in seconds $chrono->read(); // Reset the still running chrono $chrono->reset(); // Return the reseted time $chrono->read(); // Completely stop and reset the chrono $chrono->stop(); $chrono->reset();
The time is returned as a microtime float number, in seconds. You can also read it in milliseconds with:, (*3)
$chrono->readAsMilliseconds();
A lazy chrono that you don't need to start or whatever., (*4)
$chrono = new Illuminator\LazyChrono(); usleep(1000); $chrono->read();
With that class, you can time a specific task., (*5)
$timedTask = new TimedTask(function () {
usleep(1000);
});
$timedTask->read();
Note that the callback will be run each time read() is called., (*6)
Released under the MIT license., (*7)
Simple chrono
MIT
time timer stopwatch chronometer chrono