feature #35673 [Process] Add getter for process starttime (dompie)

This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Process] Add getter for process starttime

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | issue #35531
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Add a getter for process start time.

Commits
-------

3b9ed3e378 [Process] Add getter for process starttime
This commit is contained in:
Nicolas Grekas 2020-02-14 14:09:35 +01:00
commit f46ab58bcf
2 changed files with 17 additions and 0 deletions

View File

@ -1,6 +1,11 @@
CHANGELOG
=========
5.1.0
-----
* added `Process::getStartTime()` to retrieve the start time of the process as float
5.0.0
-----

View File

@ -1208,6 +1208,18 @@ class Process implements \IteratorAggregate
}
}
/**
* @throws LogicException in case process is not started
*/
public function getStartTime(): float
{
if (!$this->isStarted()) {
throw new LogicException('Start time is only available after process start.');
}
return $this->starttime;
}
/**
* Returns whether TTY is supported on the current operating system.
*/