Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return current Unix timestamp with microseconds
<?php microtime(bool $as_float = false): string|float
<?php             Silencer::call(function () use ($io) {

                $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());

                if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {

                    $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));

                }
<?php         try {

            if ($input->hasParameterOption('--profile')) {

                $startTime = microtime(true);

                $this->io->enableDebugging($startTime);

            }
<?php             }



            if (isset($startTime)) {

                $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s');

            }



            return $result;
<?php         $this->makeAssertionRuleDecisions();



        $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);

        $before = microtime(true);

        $this->runSat();

        $this->io->writeError('', true, IOInterface::DEBUG);

        $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
<?php         $before = microtime(true);

        $this->runSat();

        $this->io->writeError('', true, IOInterface::DEBUG);

        $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);



        if ($this->problems) {

            throw new SolverProblemsException($this->problems, $this->learnedPool);
<?php         if (null !== $this->startTime) {

            $memoryUsage = memory_get_usage() / 1024 / 1024;

            $timeSpent = microtime(true) - $this->startTime;

            $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {

                return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);

            }, (array) $messages);
<?php                 $activeJobs += $this->processExecutor->countActiveJobs();

            }



            if ($progress && microtime(true) - $lastUpdate > 0.1) {

                $lastUpdate = microtime(true);

                $progress->setProgress($progress->getMaxSteps() - $activeJobs);

            }
<?php             }



            if ($progress && microtime(true) - $lastUpdate > 0.1) {

                $lastUpdate = microtime(true);

                $progress->setProgress($progress->getMaxSteps() - $activeJobs);

            }
<?php         $helperMock = $this->getMockBuilder('Symfony\Component\Console\Helper\HelperSet')->getMock();



        $consoleIO = new ConsoleIO($inputMock, $outputMock, $helperMock);

        $startTime = microtime(true);

        $consoleIO->enableDebugging($startTime);



        $example = explode('\n', 'First line\nSecond lines');
<?php     {

        $process = new ProcessExecutor($buffer = new BufferIO('', StreamOutput::VERBOSITY_DEBUG));

        $process->enableAsync();

        $start = microtime(true);


        $promise = $process->executeAsync('sleep 2');

        $this->assertEquals(1, $process->countActiveJobs());
<?php         $this->assertEquals(1, $process->countActiveJobs());

        $promise->cancel();

        $this->assertEquals(0, $process->countActiveJobs());

        $end = microtime(true);

        $this->assertTrue($end - $start < 0.5, 'Canceling took longer than it should, lasted '.($end - $start));

    }
<?php     public function testSilencedException()

    {

        $verification = microtime();

        self::expectException('RuntimeException');

        self::expectExceptionMessage($verification);

        Silencer::call(function () use ($verification) {