Uses of Class
java.time.Duration
-
Packages that use Duration Package Description java.lang Provides classes that are fundamental to the design of the Java programming language.java.time The main API for dates, times, instants, and durations.java.time.temporal Access to date and time using fields and units, and date time adjusters.java.time.zone Support for time-zones and their rules.jdk.incubator.http High level HTTP and WebSocket APIjdk.jfr This package contains classes to create events and control Flight Recorder.jdk.jfr.consumer This package contains classes for consuming Flight Recorder data. -
-
Uses of Duration in java.lang
Methods in java.lang that return types with arguments of type Duration Modifier and Type Method Description Optional<Duration>ProcessHandle.Info. totalCpuDuration()Returns the total cputime accumulated of the process. -
Uses of Duration in java.time
Fields in java.time declared as Duration Modifier and Type Field Description static DurationDuration. ZEROConstant for a duration of zero.Methods in java.time that return Duration Modifier and Type Method Description DurationDuration. abs()Returns a copy of this duration with a positive length.static DurationDuration. between(Temporal startInclusive, Temporal endExclusive)Obtains aDurationrepresenting the duration between two temporal objects.DurationDuration. dividedBy(long divisor)Returns a copy of this duration divided by the specified value.static DurationDuration. from(TemporalAmount amount)Obtains an instance ofDurationfrom a temporal amount.DurationDuration. minus(long amountToSubtract, TemporalUnit unit)Returns a copy of this duration with the specified duration subtracted.DurationDuration. minus(Duration duration)Returns a copy of this duration with the specified duration subtracted.DurationDuration. minusDays(long daysToSubtract)Returns a copy of this duration with the specified duration in standard 24 hour days subtracted.DurationDuration. minusHours(long hoursToSubtract)Returns a copy of this duration with the specified duration in hours subtracted.DurationDuration. minusMillis(long millisToSubtract)Returns a copy of this duration with the specified duration in milliseconds subtracted.DurationDuration. minusMinutes(long minutesToSubtract)Returns a copy of this duration with the specified duration in minutes subtracted.DurationDuration. minusNanos(long nanosToSubtract)Returns a copy of this duration with the specified duration in nanoseconds subtracted.DurationDuration. minusSeconds(long secondsToSubtract)Returns a copy of this duration with the specified duration in seconds subtracted.DurationDuration. multipliedBy(long multiplicand)Returns a copy of this duration multiplied by the scalar.DurationDuration. negated()Returns a copy of this duration with the length negated.static DurationDuration. of(long amount, TemporalUnit unit)Obtains aDurationrepresenting an amount in the specified unit.static DurationDuration. ofDays(long days)Obtains aDurationrepresenting a number of standard 24 hour days.static DurationDuration. ofHours(long hours)Obtains aDurationrepresenting a number of standard hours.static DurationDuration. ofMillis(long millis)Obtains aDurationrepresenting a number of milliseconds.static DurationDuration. ofMinutes(long minutes)Obtains aDurationrepresenting a number of standard minutes.static DurationDuration. ofNanos(long nanos)Obtains aDurationrepresenting a number of nanoseconds.static DurationDuration. ofSeconds(long seconds)Obtains aDurationrepresenting a number of seconds.static DurationDuration. ofSeconds(long seconds, long nanoAdjustment)Obtains aDurationrepresenting a number of seconds and an adjustment in nanoseconds.static DurationDuration. parse(CharSequence text)Obtains aDurationfrom a text string such asPnDTnHnMn.nS.DurationDuration. plus(long amountToAdd, TemporalUnit unit)Returns a copy of this duration with the specified duration added.DurationDuration. plus(Duration duration)Returns a copy of this duration with the specified duration added.DurationDuration. plusDays(long daysToAdd)Returns a copy of this duration with the specified duration in standard 24 hour days added.DurationDuration. plusHours(long hoursToAdd)Returns a copy of this duration with the specified duration in hours added.DurationDuration. plusMillis(long millisToAdd)Returns a copy of this duration with the specified duration in milliseconds added.DurationDuration. plusMinutes(long minutesToAdd)Returns a copy of this duration with the specified duration in minutes added.DurationDuration. plusNanos(long nanosToAdd)Returns a copy of this duration with the specified duration in nanoseconds added.DurationDuration. plusSeconds(long secondsToAdd)Returns a copy of this duration with the specified duration in seconds added.DurationDuration. truncatedTo(TemporalUnit unit)Returns a copy of thisDurationtruncated to the specified unit.DurationDuration. withNanos(int nanoOfSecond)Returns a copy of this duration with the specified nano-of-second.DurationDuration. withSeconds(long seconds)Returns a copy of this duration with the specified amount of seconds.Methods in java.time with parameters of type Duration Modifier and Type Method Description intDuration. compareTo(Duration otherDuration)Compares this duration to the specifiedDuration.longDuration. dividedBy(Duration divisor)Returns number of whole times a specified Duration occurs within this Duration.DurationDuration. minus(Duration duration)Returns a copy of this duration with the specified duration subtracted.static ClockClock. offset(Clock baseClock, Duration offsetDuration)Obtains a clock that returns instants from the specified clock with the specified duration addedDurationDuration. plus(Duration duration)Returns a copy of this duration with the specified duration added.static ClockClock. tick(Clock baseClock, Duration tickDuration)Obtains a clock that returns instants from the specified clock truncated to the nearest occurrence of the specified duration. -
Uses of Duration in java.time.temporal
Methods in java.time.temporal that return Duration Modifier and Type Method Description DurationChronoUnit. getDuration()Gets the estimated duration of this unit in the ISO calendar system.DurationTemporalUnit. getDuration()Gets the duration of this unit, which may be an estimate. -
Uses of Duration in java.time.zone
Methods in java.time.zone that return Duration Modifier and Type Method Description DurationZoneRules. getDaylightSavings(Instant instant)Gets the amount of daylight savings in use for the specified instant in this zone.DurationZoneOffsetTransition. getDuration()Gets the duration of the transition. -
Uses of Duration in jdk.incubator.http
Methods in jdk.incubator.http that return Duration Modifier and Type Method Description abstract DurationHttpRequest. duration()Returns the duration for this request.Methods in jdk.incubator.http with parameters of type Duration Modifier and Type Method Description WebSocket.BuilderWebSocket.Builder. connectTimeout(Duration timeout)Sets a timeout for the opening handshake.abstract HttpRequest.BuilderHttpRequest.Builder. timeout(Duration duration)Sets a timeout for this request. -
Uses of Duration in jdk.jfr
Methods in jdk.jfr that return Duration Modifier and Type Method Description DurationRecording. getDuration()Returns the desired duration for this recording, ornullif no duration has been set.DurationRecording. getMaxAge()Returns how long data is to be kept in the disk repository before it is thrown away.Methods in jdk.jfr with parameters of type Duration Modifier and Type Method Description voidRecording. scheduleStart(Duration delay)Starts this recording after a delay.voidRecording. setDuration(Duration duration)Sets a duration for how long a recording should run before it's stopped.voidRecording. setMaxAge(Duration maxAge)Determines how far back data should be kept in disk repository.EventSettingsEventSettings. withPeriod(Duration duration)Sets the period for the event associated with this event setting.EventSettingsEventSettings. withThreshold(Duration duration)Sets the threshold for the event associated with this event setting. -
Uses of Duration in jdk.jfr.consumer
Methods in jdk.jfr.consumer that return Duration Modifier and Type Method Description DurationRecordedEvent. getDuration()Return the duration of the event, measured in nanoseconds.
-