< prev index next >

src/java.base/share/classes/java/time/Instant.java

Print this page

 190  * clock representing the current instant.
 191  * See {@link Clock} for details on the available clocks.
 192  * <p>
 193  * The Java time-scale is used for all date-time classes.
 194  * This includes {@code Instant}, {@code LocalDate}, {@code LocalTime}, {@code OffsetDateTime},
 195  * {@code ZonedDateTime} and {@code Duration}.
 196  * <p>
 197  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
 198  * class; programmers should treat instances that are
 199  * {@linkplain #equals(Object) equal} as interchangeable and should not
 200  * use instances for synchronization, or unpredictable behavior may
 201  * occur. For example, in a future release, synchronization may fail.
 202  * The {@code equals} method should be used for comparisons.
 203  *
 204  * @implSpec
 205  * This class is immutable and thread-safe.
 206  *
 207  * @since 1.8
 208  */
 209 @jdk.internal.ValueBased

 210 public final class Instant
 211         implements Temporal, TemporalAdjuster, Comparable<Instant>, Serializable {
 212 
 213     /**
 214      * Constant for the 1970-01-01T00:00:00Z epoch instant.
 215      */
 216     public static final Instant EPOCH = new Instant(0, 0);
 217     /**
 218      * The minimum supported epoch second.
 219      */
 220     private static final long MIN_SECOND = -31557014167219200L;
 221     /**
 222      * The maximum supported epoch second.
 223      */
 224     private static final long MAX_SECOND = 31556889864403199L;
 225     /**
 226      * The minimum supported {@code Instant}, '-1000000000-01-01T00:00Z'.
 227      * This could be used by an application as a "far past" instant.
 228      * <p>
 229      * This is one year earlier than the minimum {@code LocalDateTime}.

 190  * clock representing the current instant.
 191  * See {@link Clock} for details on the available clocks.
 192  * <p>
 193  * The Java time-scale is used for all date-time classes.
 194  * This includes {@code Instant}, {@code LocalDate}, {@code LocalTime}, {@code OffsetDateTime},
 195  * {@code ZonedDateTime} and {@code Duration}.
 196  * <p>
 197  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
 198  * class; programmers should treat instances that are
 199  * {@linkplain #equals(Object) equal} as interchangeable and should not
 200  * use instances for synchronization, or unpredictable behavior may
 201  * occur. For example, in a future release, synchronization may fail.
 202  * The {@code equals} method should be used for comparisons.
 203  *
 204  * @implSpec
 205  * This class is immutable and thread-safe.
 206  *
 207  * @since 1.8
 208  */
 209 @jdk.internal.ValueBased
 210 @jdk.internal.MigratedValueClass
 211 public final class Instant
 212         implements Temporal, TemporalAdjuster, Comparable<Instant>, Serializable {
 213 
 214     /**
 215      * Constant for the 1970-01-01T00:00:00Z epoch instant.
 216      */
 217     public static final Instant EPOCH = new Instant(0, 0);
 218     /**
 219      * The minimum supported epoch second.
 220      */
 221     private static final long MIN_SECOND = -31557014167219200L;
 222     /**
 223      * The maximum supported epoch second.
 224      */
 225     private static final long MAX_SECOND = 31556889864403199L;
 226     /**
 227      * The minimum supported {@code Instant}, '-1000000000-01-01T00:00Z'.
 228      * This could be used by an application as a "far past" instant.
 229      * <p>
 230      * This is one year earlier than the minimum {@code LocalDateTime}.
< prev index next >