Returns a new interval shifted backward in time by the given duration.

@param duration a time duration
@return the new shifted interval
8566
public TimeInterval minus(TimeDuration duration) {
        return between(start.minus(duration), end.minus(duration));
    }
554575
public function Sub( $duration )
	{
		if ( ! $duration instanceof DurationValue )
		{
			throw new \InvalidArgumentException();
		}

		$duration->Value->invert = ! $duration->Value->invert;
		$this->Add( $duration );

		// // Finally convert $multipliedInterval into a normalized interval
		// /**
		//  * @var \DateTime $dt
		//  */
		// $dt = new \DateTimeImmutable( "2017-06-07" );
		// /**
		//  * @var \DateTime $added
		//  */
		// $added = $dt->add( $this->Value );
		// $duration->Value->invert = ! $duration->Value->invert;
		// /**
		//  * @var \DateTime $subtracted
		//  */
		// $subtracted = $added->add( $duration->Value );
		// /**
		//  * @var \DateInterval $diff
		//  */
		// $diff = $subtracted->diff( $dt );
		// $diff->invert = $diff->days == 0 ? false : ! $diff->invert;
        //
		// $this->Value = $diff;
	}
495909
public MachineTime<U> minus(MachineTime<U> duration) {

        if (duration.isEmpty()) {
            return this;
        } else if (this.isEmpty()) {
            return duration.inverse();
        }

        long s = Math.subtractExact(this.seconds, duration.seconds);
        int f = this.nanos - duration.nanos;
        return new MachineTime<>(s, f, this.scale);

    }
617949
public void setDuration(@NotNull final Duration duration) {
        if (duration.compareTo(MAXIMUM_DURATION) > 0) {
            throw new IllegalArgumentException("The duaration has to be smaller than 23:59:59.");
        }
        super.setValue(durationToDate(duration));
    }
36040
public Duration add( Duration duration ) {
        return new Duration(this.durationInNanos + (duration == null ? 0l : duration.longValue()));
    }
54469
public final void setMinimumDuration(Duration duration) {
        Objects.requireNonNull(duration);
        if (minimumDuration != null) {
            minimumDuration.set(duration);
        } else {
            _minimumDuration = duration;
        }
    }
33389
public static double durationMinutes(LocalDateTime start, LocalDateTime end)
   {
	   
      return Duration.between(start, end).toMinutes();
   }
476979
protected final TR getOrCreateTimeRange(long timestamp) {
		TR timeRange;
		if (lastTimeRange == null || timestamp > lastTimeRange.getEndTimestamp()) {
			// New time range
			long roundedTimestamp = timestamp - timestamp % timeRangeWidth;
			timeRange = createTimeRange(roundedTimestamp, roundedTimestamp + timeRangeWidth);
			timeRanges.add(timeRange);
			lastTimeRange = timeRange;
		} else if (timestamp >= lastTimeRange.getStartTimestamp()) {
			// Current time range
			timeRange = lastTimeRange;
		} else {
			// Old time range
			timeRange = null;
			// Not very good from performance point of view
			// iterating from end till start would be a better solution
			for (TR oldTimeRange : timeRanges) {
				if (oldTimeRange.containsTimestamp(timestamp)) {
					timeRange = oldTimeRange;
					break;
				}
			}
		}

		return timeRange;
	}
525335
def set_duration(self, duration):
        
        if duration == 0:
            self.widget.setDuration(-2) #: Infinite
        else:
            self.widget.setDuration(0)
997822
public static double durationSeconds(LocalDateTime start, LocalDateTime end)
   {
	   return Duration.between(start, end).getSeconds();
   }
798964
public function plusDuration(Duration $duration) : LocalTime
    {
        return $this
            ->plusSeconds($duration->getSeconds())
            ->plusNanos($duration->getNanos());
    }
194255
function (duration) {
    if (typeof duration !== 'string') {
      duration = duration + 'ms';
    }

    return this.each(function () {
      this.style.webkitTransitionDuration = duration;
      this.style.transitionDuration = duration;
    });
  }
458117
public function sub(QtiDuration $duration)
    {
        if ($duration->longerThanOrEquals($this) === true) {
            $this->setInterval(new DateInterval('PT0S'));
        } else {
            $refStrDate = '@0';
            $tz = new DateTimeZone(self::TIMEZONE);
            $d1 = new DateTime($refStrDate, $tz);
            $d2 = new DateTime($refStrDate, $tz);

            $d1->add(new DateInterval($this->__toString()));
            $d2->add(new DateInterval($duration->__toString()));

            $interval = $d1->diff($d2);
            $this->setInterval($interval);
        }
    }
65295
public static function FromDuration( $duration )
	{
		if ( $duration instanceof DurationValue )
			$duration = $duration->getValue();

		// Correct the month count
		if ( $duration->d > 30 && $duration->m > 0 ) $duration->m -= 1;

		$duration->d = 0;
		$duration->h = 0;
		$duration->i = 0;
		$duration->s = 0;
		$duration->microseconds = 0;
		$duration->daysOnly = false;

		return new YearMonthDurationValue( $duration );
	}
253529
public final Dur add(final Dur duration) {
        if ((!isNegative() && duration.isNegative())
                || (isNegative() && !duration.isNegative())) {

            throw new IllegalArgumentException(
                    "Cannot add a negative and a positive duration");
        }

        Dur sum;
        if (weeks > 0 && duration.weeks > 0) {
            sum = new Dur(weeks + duration.weeks);
        }
        else {
            int daySum = (weeks > 0) ? weeks * DAYS_PER_WEEK + days : days;
            int hourSum = hours;
            int minuteSum = minutes;
            int secondSum = seconds;

            if ((secondSum + duration.seconds) / SECONDS_PER_MINUTE > 0) {
                minuteSum += (secondSum + duration.seconds) / SECONDS_PER_MINUTE;
                secondSum = (secondSum + duration.seconds) % SECONDS_PER_MINUTE;
            }
            else {
                secondSum += duration.seconds;
            }

            if ((minuteSum + duration.minutes) / MINUTES_PER_HOUR > 0) {
                hourSum += (minuteSum + duration.minutes) / MINUTES_PER_HOUR;
                minuteSum = (minuteSum + duration.minutes) % MINUTES_PER_HOUR;
            }
            else {
                minuteSum += duration.minutes;
            }

            if ((hourSum + duration.hours) / HOURS_PER_DAY > 0) {
                daySum += (hourSum + duration.hours) / HOURS_PER_DAY;
                hourSum = (hourSum + duration.hours) % HOURS_PER_DAY;
            }
            else {
                hourSum += duration.hours;
            }

            daySum += (duration.weeks > 0) ? duration.weeks * DAYS_PER_WEEK
                    + duration.days : duration.days;

            sum = new Dur(daySum, hourSum, minuteSum, secondSum);
        }
        sum.negative = negative;
        return sum;
    }
661477
@Override
    public final <T extends TimePoint<? super U, T>> T subtractFrom(T time) {

        return this.add(time, this, true);

    }
852052
public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
        return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
    }