if ($minutes !== 0) { $buf .= $minutes . 'M'; } if ($secs === 0 && $this->nanos === 0 && strlen($buf) > 2) { return $buf; } if ($secs < 0 && $this->nanos > 0) { if ($secs === -1) { $buf .= "-0"; } else { $buf .= $secs + 1; } } else { $buf .= $secs; } if ($this->nanos > 0) { $pos = strlen($buf); if ($secs < 0) { $buf .= 2 * LocalTime::NANOS_PER_SECOND - $this->nanos; } else { $buf .= $this->nanos + LocalTime::NANOS_PER_SECOND; } $buf = rtrim($buf, "0"); $buf[$pos] = '.'; } $buf .= 'S'; return $buf; } } Duration::init();