Get duration

If no "duration" value has been set, this method will
set and return a default "duration" value,
if any such value is available

@see getDefaultDuration()

@return float|null duration or null if no duration has been set
171909
public function getDuration() : ?float 
    {
        if ( ! $this->hasDuration()) {
            $this->setDuration($this->getDefaultDuration());
        }
        return $this->duration;
    }
941956
protected function getMinutes($duration)
    {
        if ($duration instanceof DateTime) {
            $duration = (time()-$duration->getTimestamp()) / 60;
        }

        return (int) ($duration * 60) > 0 ? $duration : null;
    }
318038
public function getDefault()
    {
        if ($this->default) {
            return $this->default;
        }
        if (!empty($this->values)) {
            return reset($this->values);
        }
        return null;
    }
178686
public function getDuration()
    {
        $name = trim((string) $this->getParameter('name'));
        $fullPage = StringUtils::strToBool((string)$this->getParameter('FullPage'));
        if (empty($name))
            $name = 'default';

        if (in_array($name, explode(',', 'none,never,off,0,zero,no')))
            return 0;

        if (!array_key_exists($name, $this->durations))
            $name = 'default';

        $duration = abs((int)$this->durations[$name]);

        if (!$fullPage || $duration < 1)
            return $duration;

        // full page cache duration should be half the cache time
        return ceil($duration/2);
    }
842086
public function getLoadValue()
    {
        if ($this->formField->value !== null) {
            return $this->formField->value;
        }

        $defaultValue = !$this->model->exists
            ? $this->formField->getDefaultFromData($this->data ?: $this->model)
            : null;

        return $this->formField->getValueFromData($this->data ?: $this->model, $defaultValue);
    }
328207
public com.google.protobuf.Duration getExpiration() {
    return expiration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : expiration_;
  }
176131
function () {
            if (this._duration) {
                return this._duration;
            }
            if (this._start && this._end) {
                return moment.duration(this._end - this._start);
            }
            else {
                return moment.duration(0);
            }
        }
1125566
public function getDefaultMonth()
    {
        $result = null;

        $keys = array_keys($this->getMonths());
        if (count($keys) >= 2) {
            $result = (string)$keys[1];
        }

        return $result;
    }
1234303
public function getSessionTimeOut()
    {
        if ($this->offsetExists('session') && isset($this->session['idleTimeout'])) {
            return $this->session['idleTimeout'];
        } else {
            return $this->defaultSessionTimeout;
        }
    }
694828
public function getValue()
    {
        $value = parent::getValue();
        return $value === null || $value === [] ? $this->getDefaultValue() : $value;
    }
256519
public function getDefaultValue()
    {
        if (1 != $this->parameters->get('defaultValueIsNull')) {
            $defaultValue = $this->parameters->get('defaultValue');
            if (strlen($defaultValue) && 'NULL' != $defaultValue) {
                return trim($defaultValue, '\'"');
            }
        }
    }
770090
public function getElapsedTime() : Duration
    {
        if ($this->startTime === null) {
            return $this->duration;
        }

        return $this->duration->plus(Duration::between($this->startTime, $this->clock->getTime()));
    }
334777
public function getDuration(int $precision = -1)
    {
        //var_dump($this->duration);
        $duration = $this->duration ?? microtime(true) - $this->startTime;
        return $this->fmtDuration($duration, $precision);
    }
237245
public function getDuration()
	{
		$started = (is_null($this->started)) ? new \DateTime('now') : $this->started;
		$stopped = (is_null($this->stopped)) ? new \DateTime('now') : $this->stopped;

		return $started->diff($stopped);
	}
211321
public function getTimestamp() : ?int 
    {
        if ( ! $this->hasTimestamp()) {
            $this->setTimestamp($this->getDefaultTimestamp());
        }
        return $this->timestamp;
    }
578556
public function getLength() : ?float 
    {
        if ( ! $this->hasLength()) {
            $this->setLength($this->getDefaultLength());
        }
        return $this->length;
    }
997565
protected static function get_duration_text($seconds) {
        if (empty($seconds)) {
            return get_string('none');
        }
        $data = self::parse_seconds($seconds);
        switch ($data['u']) {
            case (60*60*24*7):
                return get_string('numweeks', '', $data['v']);
            case (60*60*24):
                return get_string('numdays', '', $data['v']);
            case (60*60):
                return get_string('numhours', '', $data['v']);
            case (60):
                return get_string('numminutes', '', $data['v']);
            default:
                return get_string('numseconds', '', $data['v']*$data['u']);
        }
    }