src/LocalTime.php
public function plusNanos(int $nanos) : LocalTime
    {
        if ($nanos === 0) {
            return $this;
        }

        $divBase = Math::floorDiv($this->nano, LocalTime::NANOS_PER_SECOND);
        $modBase = Math::floorMod($this->nano, LocalTime::NANOS_PER_SECOND);

        $divPlus = Math::floorDiv($nanos, LocalTime::NANOS_PER_SECOND);
        $modPlus = Math::floorMod($nanos, LocalTime::NANOS_PER_SECOND);

        $diffSeconds = $divBase + $divPlus;
        $nano = $modBase + $modPlus;

        if ($nano >= LocalTime::NANOS_PER_SECOND) {
            $nano -= LocalTime::NANOS_PER_SECOND;
            $diffSeconds++;
        }

        return $this->withNano($nano)->plusSeconds($diffSeconds);
    }
public function plusNanos(int $nanos) : LocalTime
    {
        if ($nanos === 0) {
            return $this;
        }

        $divBase = Math::floorDiv($this->nano, LocalTime::NANOS_PER_SECOND);
        $modBase = Math::floorMod($this->nano, LocalTime::NANOS_PER_SECOND);

        $divPlus = Math::floorDiv($nanos, LocalTime::NANOS_PER_SECOND);
        $modPlus = Math::floorMod($nanos, LocalTime::NANOS_PER_SECOND);

        $diffSeconds = $divBase + $divPlus;
        $nano = $modBase + $modPlus;

        if ($nano >= LocalTime::NANOS_PER_SECOND) {
            $nano -= LocalTime::NANOS_PER_SECOND;
            $diffSeconds++;
        }

        return $this->withNano($nano)->plusSeconds($diffSeconds);
    }
public function plusNanos ( int $ nanos ) : LocalTime { if ( $ nanos === 0 ) { return $ this ; } $ divBase = Math :: floorDiv ( $ this -> nano , LocalTime :: NANOS_PER_SECOND ) ; $ modBase = Math :: floorMod ( $ this -> nano , LocalTime :: NANOS_PER_SECOND ) ; $ divPlus = Math :: floorDiv ( $ nanos , LocalTime :: NANOS_PER_SECOND ) ; $ modPlus = Math :: floorMod ( $ nanos , LocalTime :: NANOS_PER_SECOND ) ; $ diffSeconds = $ divBase + $ divPlus ; $ nano = $ modBase + $ modPlus ; if ( $ nano >= LocalTime :: NANOS_PER_SECOND ) { $ nano -= LocalTime :: NANOS_PER_SECOND ; $ diffSeconds ++ ; } return $ this -> withNano ( $ nano ) -> plusSeconds ( $ diffSeconds ) ; }
Returns a copy of this LocalTime with the specified period in nanoseconds added.

@param int $nanos The seconds to add, may be negative.

@return LocalTime A LocalTime based on this time with the nanoseconds added.

@throws DateTimeException
Returns a copy of this LocalTime with the specified period in nanoseconds added .