コード例 #1
0
 /**
  * Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds added.
  * <p>
  * This instance is immutable and unaffected by this method call.
  *
  * @param int $nanos the nanos to add, may be negative
  * @return OffsetDateTime an {@code OffsetDateTime} based on this date-time with the nanoseconds added, not null
  * @throws DateTimeException if the unit cannot be added to this type
  */
 public function plusNanos($nanos)
 {
     return $this->_with($this->dateTime->plusNanos($nanos), $this->offset);
 }
コード例 #2
0
 /**
  * Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds added.
  * <p>
  * This operates on the instant time-line, such that adding one nano will
  * always be a duration of one nano later.
  * This may cause the local date-time to change by an amount other than one nano.
  * Note that this is a different approach to that used by days, months and years.
  * <p>
  * This instance is immutable and unaffected by this method call.
  *
  * @param int $nanos the nanos to add, may be negative
  * @return ZonedDateTime a {@code ZonedDateTime} based on this date-time with the nanoseconds added, not null
  * @throws DateTimeException if the result exceeds the supported date range
  */
 public function plusNanos($nanos)
 {
     return $this->resolveInstant($this->dateTime->plusNanos($nanos));
 }