models/classes/runner/time/QtiTimeConstraint.php
protected function getRemainingTimeFrom(QtiDuration $duration)
    {
        if(!is_null($duration)){
            $remaining = clone $duration;

            if ($this->getApplyExtraTime() && $this->timer) {
                // take care of the already consumed extra time under the current constraint
                // and append the full remaining extra time
                // the total must correspond to the already elapsed time plus the remaining time
                $remaining->add(new QtiDuration('PT' . $this->timer->getExtraTime($duration->getSeconds(true)) . 'S'));
            }
            $remaining->sub($this->getDuration());
            return ($remaining->isNegative() === true) ? new QtiDuration('PT0S') : $remaining;
        }
        return false;
    }
protected function getRemainingTimeFrom(QtiDuration $duration)
    {
        if(!is_null($duration)){
            $remaining = clone $duration;

            if ($this->getApplyExtraTime() && $this->timer) {
                // take care of the already consumed extra time under the current constraint
                // and append the full remaining extra time
                // the total must correspond to the already elapsed time plus the remaining time
                $remaining->add(new QtiDuration('PT' . $this->timer->getExtraTime($duration->getSeconds(true)) . 'S'));
            }
            $remaining->sub($this->getDuration());
            return ($remaining->isNegative() === true) ? new QtiDuration('PT0S') : $remaining;
        }
        return false;
    }
Get the remaining duration from a source (min or max time, usually)
@param QtiDuration $duration the source duration
@return Duration|false A Duration object (or false of not available) that represents the remaining time