java.lang.Object
com.aoapps.lang.time.Duration
- All Implemented Interfaces:
Serializable
,Comparable<Duration>
Deprecated.
Please use standard Java 8 classes.
Wraps a duration as the number of seconds as well as positive nanoseconds into an
immutable value type.
This will be deprecated once Java 8 is ubiquitous and only serves as an extremely simplified stop-gap.
- Author:
- AO Industries, Inc.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Duration
Deprecated.int
Deprecated.boolean
Deprecated.boolean
Deprecated.int
getNano()
Deprecated.The nanoseconds, to simplify this is always in the positive direction.long
Deprecated.int
hashCode()
Deprecated.protected Object
Deprecated.long
toNanos()
Deprecated.Gets this duration as a number of nanoseconds only.toString()
Deprecated.
-
Field Details
-
ZERO
Deprecated.
-
-
Constructor Details
-
Duration
public Duration(long seconds, int nano) Deprecated.
-
-
Method Details
-
between
Deprecated. -
readResolve
Deprecated. -
toString
Deprecated. -
equals
Deprecated. -
equals
Deprecated. -
hashCode
public int hashCode()Deprecated. -
compareTo
Deprecated.- Specified by:
compareTo
in interfaceComparable<Duration>
-
getSeconds
public long getSeconds()Deprecated. -
getNano
public int getNano()Deprecated.The nanoseconds, to simplify this is always in the positive direction. For negative durations, this means the nanos goes up from zero to 1 billion, then the seconds go up one (toward zero). This may be counterintuitive if one things of nanoseconds as a fractional part of seconds, but this definition leads to a very clean implementation.Counting up by nanoseconds:
- -1.999999998
- -1.999999999
- 0.000000000
- 0.000000001
- 0.000000002
-
toNanos
Deprecated.Gets this duration as a number of nanoseconds only. This covers a range around -292 years to +292 years.- Throws:
ArithmeticException
- if duration is outside the range representable in nanoseconds
-