public function dividedBy(int $divisor) : Duration
    {
        if ($divisor === 0) {
            throw new DateTimeException('Cannot divide a Duration by zero.');
        }

        if ($divisor === 1) {
            return $this;
        }

        $seconds = $this->seconds;
        $nanos = $this->nanos;

        if ($seconds < 0 && $nanos !== 0) {
            $seconds++;
            $nanos -= LocalTime::NANOS_PER_SECOND;
        }

        $remainder = $seconds % $divisor;
        $seconds = \intdiv($seconds, $divisor);

        $r1 = $nanos % $divisor;
        $nanos = \intdiv($nanos, $divisor);

        $r2 = LocalTime::NANOS_PER_SECOND % $divisor;
        $nanos += $remainder * \intdiv(LocalTime::NANOS_PER_SECOND, $divisor);
        $nanos += \intdiv($r1 + $remainder * $r2, $divisor);

        if ($nanos < 0) {
            $seconds--;
            $nanos = LocalTime::NANOS_PER_SECOND + $nanos;
        }

        return new Duration($seconds, $nanos);
    }