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.net.http HTTP Client and WebSocket APIsjava.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.java.util.concurrent Utility classes commonly useful in concurrent programming.jdk.jfr This package provides 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.net.http
Methods in java.net.http that return types with arguments of type Duration Modifier and Type Method Description abstract Optional<Duration>HttpClient. connectTimeout()Returns anOptionalcontaining the connect timeout duration for this client.abstract Optional<Duration>HttpRequest. timeout()Returns anOptionalcontaining this request's timeout duration.Methods in java.net.http with parameters of type Duration Modifier and Type Method Description HttpClient.BuilderHttpClient.Builder. connectTimeout(Duration duration)Sets the connect timeout duration for this client.WebSocket.BuilderWebSocket.Builder. connectTimeout(Duration timeout)Sets a timeout for establishing a WebSocket connection.HttpRequest.BuilderHttpRequest.Builder. timeout(Duration duration)Sets a timeout for this request. -
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 java.util.concurrent
Methods in java.util.concurrent with parameters of type Duration Modifier and Type Method Description longTimeUnit. convert(Duration duration)Converts the given time duration to this unit. -
Uses of Duration in jdk.jfr
Methods in jdk.jfr that return Duration Modifier and Type Method Description DurationRecording. getDuration()Returns the specified duration for this recording, ornullif no duration is set.DurationRecording. getMaxAge()Returns the length of time that the data is kept in the disk repository before it is removed.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 runs before it stops.voidRecording. setMaxAge(Duration maxAge)Determines how far back data is kept in the disk repository.EventSettingsEventSettings. withPeriod(Duration duration)Sets the interval for the event that is associated with this event setting.EventSettingsEventSettings. withThreshold(Duration duration)Sets the threshold for the event that is 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()Returns the duration of the event, measured in nanoseconds.DurationRecordedObject. getDuration(String name)Returns the value of a timespan field.
-