Subtract two durations.

 @param [Duration] other The duration to subtract.

 @return [Duration] The resulting duration with each component subtracted
   from the input duration.

 @example
   1.day - 1.hour == 23.hours
438517
def -(other)
      case other
      when 0
        self
      when Duration
        Duration.new(
          seconds: @seconds - other.get(:seconds),
          months: @months - other.get(:months)
        )
      else
        raise ArgumentError, "Cannot subtract #{other.inspect} from Duration #{self}"
      end
    end
788093
def subtract_business_days(date, delta)
      date = roll_backward(date)
      delta.times do
        begin
          date -= day_interval_for(date)
        end until business_day?(date)
      end
      date
    end
444741
public DiscreteInterval minus(DiscreteInterval other) {
        return new DiscreteInterval(this.min - other.max, this.max - other.min);
    }
304617
void subtract(DiyFp other) {
        assert (e == other.e);
        assert uint64_gte(f, other.f);
        f -= other.f;
    }
1055442
function(a, b) {
        if ((a.timesNotSelected || 0) < b.timesNotSelected) {
            return -1;
        }
        else if ((a.timesNotSelected || 0) > b.timesNotSelected) {
            return 1;
        }
        return 0;
    }
460188
def _subtract_timedelta(self, delta):
        
        if isinstance(delta, pendulum.Duration):
            return self.subtract(
                years=delta.years,
                months=delta.months,
                weeks=delta.weeks,
                days=delta.remaining_days,
                hours=delta.hours,
                minutes=delta.minutes,
                seconds=delta.remaining_seconds,
                microseconds=delta.microseconds,
            )

        return self.subtract(
            days=delta.days, seconds=delta.seconds, microseconds=delta.microseconds
        )
100310
def half_duration(self):
        """"""
        if self._interval is not None:
            a, b = self._interval
            return (b - a) * .5
        else:
            return self.interval_duration * .5
299971
def duration(part = nil, klass = Duration)
          if [:years, :months, :weeks, :days, :hours, :minutes, :seconds].include? part
              klass.new(part => self)
          else
              klass.new(self)
          end
      end
694165
public static long subSeconds(final Date date1, final Date date2) {

    return subTime(date1, date2, DatePeriod.SECOND);
  }
1038268
public static long subMinutes(final Date date1, final Date date2) {

    return subTime(date1, date2, DatePeriod.MINUTE);
  }
281312
def subtract_timedelta(self, delta):
        
        if delta.days:
            raise TypeError("Cannot subtract timedelta with days to Time.")

        return self.subtract(seconds=delta.seconds, microseconds=delta.microseconds)
84368
def calculate_duration
      @duration = 0
      if @tracks.nil? || @tracks.size.zero? || @tracks[0].segments.nil? || @tracks[0].segments.size.zero?
        return @duration
      end
      @duration = (@tracks[-1].segments[-1].points[-1].time - @tracks.first.segments.first.points.first.time)
    rescue StandardError
      @duration = 0
    end
1029548
def _get_offset_day(self, other):
        
        mstart = datetime(other.year, other.month, 1)
        wday = mstart.weekday()
        shift_days = (self.weekday - wday) % 7
        return 1 + shift_days + self.week * 7
556183
public int dividedBy(TimeDuration duration) {
        // (a + b)/(c + d) = 1 / ((c + d) / a) + 1 / ((c + d) / b)
        // XXX This will not have the precision it should
        double thisDuration = (double) getSec() * (double) NANOSEC_IN_SEC + (double) getNanoSec();
        double otherDuration = (double) duration.getSec() * (double) NANOSEC_IN_SEC + (double) duration.getNanoSec();
        return (int) (thisDuration / otherDuration);
    }
727960
def %(other)
      if Duration === other || Scalar === other
        Duration.build(value % other.value)
      elsif Numeric === other
        Duration.build(value % other)
      else
        raise_type_error(other)
      end
    end
346756
def add_or_subtract!(operator,other)
      if other.is_a? Quantity
        other = other.to(@unit) if other.unit.is_alternative_for?(@unit)

        if @unit.is_equivalent_to? other.unit
          @value = @value.send operator, other.value

          return self
        else
          raise Quantify::Exceptions::InvalidObjectError, "Cannot add or subtract Quantities with different dimensions"
        end
      else
        raise Quantify::Exceptions::InvalidObjectError, "Cannot add or subtract non-Quantity objects"
      end
    end
394703
@Override
  public ByteAmount minus(ResourceMeasure<Long> other) {
    checkArgument(Long.MIN_VALUE + other.value <= value,
        String.format("Subtracting %s from %s would overshoot Long.MIN_LONG", other, this));
    return ByteAmount.fromBytes(value - other.value);
  }