src/Duration.php
public static function ofSeconds(int $seconds, int $nanoAdjustment = 0) : Duration
    {
        $nanoseconds = $nanoAdjustment % LocalTime::NANOS_PER_SECOND;
        $seconds += ($nanoAdjustment - $nanoseconds) / LocalTime::NANOS_PER_SECOND;

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

        return new Duration($seconds, $nanoseconds);
    }
public static function ofSeconds(int $seconds, int $nanoAdjustment = 0) : Duration
    {
        $nanoseconds = $nanoAdjustment % LocalTime::NANOS_PER_SECOND;
        $seconds += ($nanoAdjustment - $nanoseconds) / LocalTime::NANOS_PER_SECOND;

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

        return new Duration($seconds, $nanoseconds);
    }
public static function ofSeconds ( int $ seconds , int $ nanoAdjustment = 0 ) : Duration { $ nanoseconds = $ nanoAdjustment % LocalTime :: NANOS_PER_SECOND ; $ seconds += ( $ nanoAdjustment - $ nanoseconds ) / LocalTime :: NANOS_PER_SECOND ; if ( $ nanoseconds < 0 ) { $ nanoseconds += LocalTime :: NANOS_PER_SECOND ; $ seconds -- ; } return new Duration ( $ seconds , $ nanoseconds ) ; }
Returns a Duration representing a number of seconds and an adjustment in nanoseconds.

This method allows an arbitrary number of nanoseconds to be passed in.
The factory will alter the values of the second and nanosecond in order
to ensure that the stored nanosecond is in the range 0 to 999,999,999.
For example, the following will result in the exactly the same duration:

* Duration::ofSeconds(3, 1);
* Duration::ofSeconds(4, -999999999);
* Duration::ofSeconds(2, 1000000001);

@param int $seconds        The number of seconds of the duration.
@param int $nanoAdjustment The adjustment to the duration in nanoseconds.

@return \Brick\DateTime\Duration
Returns a Duration representing a number of seconds and an adjustment in nanoseconds .