From 3b9ed3e378982120ce8010a8adaf9d0a3add6f05 Mon Sep 17 00:00:00 2001 From: Dominik Piekarski Date: Tue, 11 Feb 2020 13:33:01 +0100 Subject: [PATCH] [Process] Add getter for process starttime --- src/Symfony/Component/Process/CHANGELOG.md | 5 +++++ src/Symfony/Component/Process/Process.php | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/Symfony/Component/Process/CHANGELOG.md b/src/Symfony/Component/Process/CHANGELOG.md index 9ff05cf4f6..3f3a020226 100644 --- a/src/Symfony/Component/Process/CHANGELOG.md +++ b/src/Symfony/Component/Process/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +5.1.0 +----- + + * added `Process::getStartTime()` to retrieve the start time of the process as float + 5.0.0 ----- diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 69ccc08489..456f2eb343 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -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. */