[Stopwatch] Fix precision for root section

This commit is contained in:
Gregor Harlan 2017-07-16 20:35:34 +02:00 committed by Nicolas Grekas
parent b24a338f71
commit b2c0dc3901
2 changed files with 13 additions and 1 deletions

View File

@ -38,8 +38,8 @@ class Stopwatch
*/
public function __construct($morePrecision = false)
{
$this->reset();
$this->morePrecision = $morePrecision;
$this->reset();
}
/**

View File

@ -100,6 +100,18 @@ class StopwatchTest extends TestCase
$stopwatch->stop('foo');
}
public function testMorePrecision()
{
$stopwatch = new Stopwatch(true);
$stopwatch->start('foo');
$event = $stopwatch->stop('foo');
$this->assertInternalType('float', $event->getStartTime());
$this->assertInternalType('float', $event->getEndTime());
$this->assertInternalType('float', $event->getDuration());
}
public function testSection()
{
$stopwatch = new Stopwatch();