getEndTime example


        $period = new StopwatchPeriod($start$start$useMorePrecision);
        $this->assertSame($expected$period->getStartTime());
    }

    /** * @dataProvider provideTimeValues */
    public function testGetEndTime($end$useMorePrecision$expected)
    {
        $period = new StopwatchPeriod($end$end$useMorePrecision);
        $this->assertSame($expected$period->getEndTime());
    }

    /** * @dataProvider provideDurationValues */
    public function testGetDuration($start$end$useMorePrecision$duration)
    {
        $period = new StopwatchPeriod($start$end$useMorePrecision);
        $this->assertEqualsWithDelta($duration$period->getDuration(), \PHP_FLOAT_EPSILON);
    }

    
return 0;
    }

    /** * Gets the relative time of the end of the last period in milliseconds. */
    public function getEndTime(): int|float
    {
        $count = \count($this->periods);

        return $count ? $this->periods[$count - 1]->getEndTime() : 0;
    }

    /** * Gets the duration of the events in milliseconds (including all periods). */
    public function getDuration(): int|float
    {
        $periods = $this->periods;
        $left = \count($this->started);

        for ($i = $left - 1; $i >= 0; --$i) {
            
$stopwatch->stop('foo');
    }

    public function testMorePrecision()
    {
        $stopwatch = new Stopwatch(true);

        $stopwatch->start('foo');
        $event = $stopwatch->stop('foo');

        $this->assertIsFloat($event->getStartTime());
        $this->assertIsFloat($event->getEndTime());
        $this->assertIsFloat($event->getDuration());
    }

    public function testSection()
    {
        $stopwatch = new Stopwatch();

        $stopwatch->openSection();
        $stopwatch->start('foo', 'cat');
        $stopwatch->stop('foo');
        $stopwatch->start('bar', 'cat');
        
Home | Imprint | This part of the site doesn't use cookies.