- java.lang.Object
-
- com.aoapps.lang.time.Instant
-
- All Implemented Interfaces:
Serializable,Comparable<Instant>
@Deprecated public class Instant extends Object implements Comparable<Instant>, Serializable
Deprecated.Please use standard Java 8 classes.Wraps the number of seconds from the Epoch 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Instant(long epochSecond, int nano)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intcompareTo(Instant other)Deprecated.booleanequals(Instant other)Deprecated.booleanequals(Object obj)Deprecated.longgetEpochSecond()Deprecated.intgetNano()Deprecated.The nanoseconds, to simplify this is always in the positive direction.inthashCode()Deprecated.InstantplusNanos(long nanosToAdd)Deprecated.protected ObjectreadResolve()Deprecated.StringtoString()Deprecated.static InstantvalueOf(String s)Deprecated.Parses an Instant's string representation.
-
-
-
Field Detail
-
EPOCH
public static final Instant EPOCH
Deprecated.
-
-
Method Detail
-
valueOf
public static Instant valueOf(String s)
Deprecated.Parses an Instant's string representation.- Returns:
- Instant the instant or null when toString is null
- Throws:
IllegalArgumentException- when unable to parse
-
readResolve
protected Object readResolve()
Deprecated.
-
equals
public boolean equals(Instant other)
Deprecated.
-
compareTo
public int compareTo(Instant other)
Deprecated.- Specified by:
compareToin interfaceComparable<Instant>
-
getEpochSecond
public long getEpochSecond()
Deprecated.
-
getNano
public int getNano()
Deprecated.The nanoseconds, to simplify this is always in the positive direction. For negative instants, 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
-
plusNanos
public Instant plusNanos(long nanosToAdd)
Deprecated.
-
-