Set the long press duration.

@param duration the value to set.
Time resolution unit is 1 ms.
@return this instance for chaining.
424549
public LongPressOptions withDuration(Duration duration) {
        checkNotNull(duration);
        checkArgument(duration.toMillis() >= 0,
                "Duration value should be greater or equal to zero");
        this.duration = duration;
        return this;
    }
64923
protected function setDuration($duration)
	{
		if (is_numeric($duration) && $duration >= 0)
		{
			$duration = new TimeInterval($duration);
		}
		
		if ( ! $duration instanceof TimeInterval)
		{
			throw new \InvalidArgumentException('The duration value must be a positive number value.');
		}
		
		$this->duration = $duration;
		
		return $this;
	}
894855
public <T extends CacheSpec<K, V>> T expiresAfterWrite(String duration) {
      this.expiresAfterWrite = convertStringToTime(duration);
      return Cast.as(this);
   }
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);

    }
910
private Duration getDuration(TimeUnit units, Double duration)
   {
      Duration result = null;
      if (duration != null)
      {
         double durationValue = duration.doubleValue() * 100.0;

         switch (units)
         {
            case MINUTES:
            {
               durationValue *= MINUTES_PER_DAY;
               break;
            }

            case HOURS:
            {
               durationValue *= HOURS_PER_DAY;
               break;
            }

            case DAYS:
            {
               durationValue *= 3.0;
               break;
            }

            case WEEKS:
            {
               durationValue *= 0.6;
               break;
            }

            case MONTHS:
            {
               durationValue *= 0.15;
               break;
            }

            default:
            {
               throw new IllegalArgumentException("Unsupported time units " + units);
            }
         }

         durationValue = Math.round(durationValue) / 100.0;

         result = Duration.getInstance(durationValue, units);
      }

      return result;
   }
819376
public String format(Duration duration) {
    Long durationInMinutes = duration.toMinutes();
    if (durationInMinutes == 0) {
      return "0";
    }
    boolean isNegative = durationInMinutes < 0;
    Long absDuration = Math.abs(durationInMinutes);

    int days = ((Double) ((double) absDuration / HOURS_IN_DAY / 60)).intValue();
    Long remainingDuration = absDuration - (days * HOURS_IN_DAY * 60);
    int hours = ((Double) (remainingDuration.doubleValue() / 60)).intValue();
    remainingDuration = remainingDuration - (hours * 60);
    int minutes = remainingDuration.intValue();

    return format(days, hours, minutes, isNegative);
  }
442339
public Duration subtract( long duration,
                              TimeUnit unit ) {
        long durationInNanos = TimeUnit.NANOSECONDS.convert(duration, unit);
        return new Duration(this.durationInNanos - durationInNanos);
    }
1087768
@SuppressWarnings("unchecked")
  public T withMaxDuration(Duration maxDuration) {
    Assert.notNull(maxDuration, "maxDuration");
    this.maxDuration = maxDuration;
    return (T) this;
  }
816571
public static void setResultDisplayDurationInMs(Intent intent, long duration) {
    intent.putExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, duration);
  }
289662
public final void setDuration(int duration) {
        if (isComplete()) {
            this.getLogger()
                    .warn(
                            "{} is already closed, the new duration of {} will be ignored on: {}",
                            this.getClass().getSimpleName(),
                            duration,
                            this);
            return;
        }
        this.duration = duration;
    }
54469
public final void setMinimumDuration(Duration duration) {
        Objects.requireNonNull(duration);
        if (minimumDuration != null) {
            minimumDuration.set(duration);
        } else {
            _minimumDuration = duration;
        }
    }
532337
@Override
  public DurationFormatterFactory setTimeZone(TimeZone timeZone) {
    if (!timeZone.equals(this.timeZone)) {
      this.timeZone = timeZone;
      if (builder != null) {
          builder = builder.withTimeZone(timeZone);
      }
      reset();
    }
    return this;
  }
442363
public void setLockDuration(Duration lockDuration)
    {
        this.lockDuration = lockDuration;
        if (this.lockDuration.compareTo(ManagementClientConstants.MAX_DURATION) > 0) {
            this.lockDuration = ManagementClientConstants.MAX_DURATION;
        }
    }
1209577
public static void updateTimer(Optional<Timer> timer, final long duration, final TimeUnit unit) {
    timer.transform(new Function<Timer, Timer>() {
      @Override
      public Timer apply(@Nonnull Timer input) {
        input.update(duration, unit);
        return input;
      }
    });
  }
1092075
public static DayDuration valueOf(String duration) {
		int spacePos = duration.indexOf(' ');
		if(spacePos == -1) throw new IllegalArgumentException("Space not found in duration: " + duration);
		return getInstance(
			Integer.parseInt(duration.substring(0, spacePos)),
			Unit.valueOfUnit(duration.substring(spacePos + 1))
		);
	}
1231535
public static void setLeftDelay(Duration duration) {
        BEHAVIOR.setLeftDelay(duration == null ? Duration.millis(200) : duration);
    }
1188692
public void setDuration(int index, Duration value)
   {
      set(selectField(TaskFieldLists.CUSTOM_DURATION, index), value);
   }