[Process] Add getter for process starttime

This commit is contained in:
Dominik Piekarski 2020-02-11 13:33:01 +01:00 committed by Nicolas Grekas
parent 8c694d6157
commit 3b9ed3e378
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.
*/