private function updateRemainingTime()
    {
        $result = null;
        $remaining = 0;
        $hasTimer = false;

        $session = $this->getTestSession();

        if ($session !== null && $session->isRunning()) {
            $remaining = PHP_INT_MAX;
            $timeConstraints = $session->getTimeConstraints();
            foreach ($timeConstraints as $tc) {
                // Only consider time constraints in force.
                $maximumRemainingTime = $tc->getMaximumRemainingTime();
                if ($maximumRemainingTime !== false) {
                    $hasTimer = true;
                    $remaining = min($remaining, $maximumRemainingTime->getSeconds(true));
                }
            }
        }

        if ($hasTimer) {
            $result = $remaining;
        }

        $this->addValue(DeliveryMonitoringService::REMAINING_TIME, $result, true);
    }