Package net.jodah.lyra.util
Class Duration
java.lang.Object
net.jodah.lyra.util.Duration
- All Implemented Interfaces:
java.io.Serializable
public class Duration
extends java.lang.Object
implements java.io.Serializable
Duration unit, consisting of length and time unit.
- See Also:
- Serialized Form
-
Field Summary
-
Method Summary
Modifier and Type Method Description static Duration
days(long count)
Returns a Duration ofcount
days.boolean
equals(java.lang.Object obj)
int
hashCode()
static Duration
hours(long count)
Returns a Duration ofcount
hours.static Duration
inf()
Returns an infinite duration of Long.MAX_VALUE days.static Duration
infinite()
Returns an infinite duration of Long.MAX_VALUE days.static Duration
microseconds(long count)
Returns a Duration ofcount
microseconds.static Duration
millis(long count)
Returns a Duration ofcount
milliseconds.static Duration
milliseconds(long count)
Returns a Duration ofcount
milliseconds.static Duration
mins(long count)
Returns a Duration ofcount
minutes.static Duration
minutes(long count)
Returns a Duration ofcount
minutes.static Duration
nanos(long count)
Returns a Duration ofcount
nanoseconds.static Duration
nanoseconds(long count)
Returns a Duration ofcount
nanoseconds.static Duration
of(long count, java.util.concurrent.TimeUnit unit)
Returns a Duration ofcount
unit
s.static Duration
of(java.lang.String duration)
Returns a Duration from the parsedduration
.static Duration
seconds(long count)
Returns a Duration ofcount
seconds.static Duration
secs(long count)
Returns a Duration ofcount
seconds.long
toDays()
Returns the Duration converted to days.long
toHours()
Returns the Duration converted to hours.long
toMicros()
Returns the Duration converted to microseconds.long
toMicroseconds()
Returns the Duration converted to microseconds.long
toMillis()
Returns the Duration converted to milliseconds.long
toMilliseconds()
Returns the Duration converted to milliseconds.long
toMins()
Returns the Duration converted to minutes.long
toMinutes()
Returns the Duration converted to minutes.long
toNanos()
Returns the Duration converted to nanoseconds.long
toNanoseconds()
Returns the Duration converted to nanoseconds.long
toSeconds()
Returns the Duration converted to seconds.long
toSecs()
Returns the Duration converted to seconds.java.lang.String
toString()
-
Field Details
-
Method Details
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toDays
public long toDays()Returns the Duration converted to days. -
toHours
public long toHours()Returns the Duration converted to hours. -
toMicros
public long toMicros()Returns the Duration converted to microseconds. -
toMicroseconds
public long toMicroseconds()Returns the Duration converted to microseconds. -
toMillis
public long toMillis()Returns the Duration converted to milliseconds. -
toMilliseconds
public long toMilliseconds()Returns the Duration converted to milliseconds. -
toMins
public long toMins()Returns the Duration converted to minutes. -
toMinutes
public long toMinutes()Returns the Duration converted to minutes. -
toNanos
public long toNanos()Returns the Duration converted to nanoseconds. -
toNanoseconds
public long toNanoseconds()Returns the Duration converted to nanoseconds. -
toSeconds
public long toSeconds()Returns the Duration converted to seconds. -
toSecs
public long toSecs()Returns the Duration converted to seconds. -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
days
Returns a Duration ofcount
days. -
hours
Returns a Duration ofcount
hours. -
inf
Returns an infinite duration of Long.MAX_VALUE days. -
infinite
Returns an infinite duration of Long.MAX_VALUE days. -
microseconds
Returns a Duration ofcount
microseconds. -
millis
Returns a Duration ofcount
milliseconds. -
milliseconds
Returns a Duration ofcount
milliseconds. -
mins
Returns a Duration ofcount
minutes. -
minutes
Returns a Duration ofcount
minutes. -
nanos
Returns a Duration ofcount
nanoseconds. -
nanoseconds
Returns a Duration ofcount
nanoseconds. -
of
Returns a Duration ofcount
unit
s. -
of
Returns a Duration from the parsedduration
. Example:5 s 5 seconds 10m 10 minutes
-
seconds
Returns a Duration ofcount
seconds. -
secs
Returns a Duration ofcount
seconds.
-