An immutable representation of a point in time. Ion defines a simple representation of time based on Coordinated Universal Time (UTC). In practice the use of time could be more accurately described as UTC-SLS (UTC Smoothed Leap Seconds) as there is no representation for the leap second discontinuiti
| 73 | * @see #compareTo(Timestamp) |
| 74 | */ |
| 75 | public final class Timestamp |
| 76 | implements Comparable<Timestamp>, Cloneable |
| 77 | { |
| 78 | private static final boolean APPLY_OFFSET_YES = true; |
| 79 | private static final boolean APPLY_OFFSET_NO = false; |
| 80 | private static final boolean CHECK_FRACTION_YES = true; |
| 81 | private static final boolean CHECK_FRACTION_NO = false; |
| 82 | |
| 83 | private static final int NO_MONTH = 0; |
| 84 | private static final int NO_DAY = 0; |
| 85 | private static final int NO_HOURS = 0; |
| 86 | private static final int NO_MINUTES = 0; |
| 87 | private static final int NO_SECONDS = 0; |
| 88 | private static final BigDecimal NO_FRACTIONAL_SECONDS = null; |
| 89 | |
| 90 | /** |
| 91 | * 0001-01-01T00:00:00.0Z in millis. |
| 92 | */ |
| 93 | static final long MINIMUM_TIMESTAMP_IN_MILLIS = -62135769600000L; |
| 94 | |
| 95 | /** |
| 96 | * 0001-01-01T00:00:00.0Z in millis. |
| 97 | */ |
| 98 | static final BigDecimal MINIMUM_TIMESTAMP_IN_MILLIS_DECIMAL = new BigDecimal(MINIMUM_TIMESTAMP_IN_MILLIS); |
| 99 | |
| 100 | /** |
| 101 | * 10000T in millis, upper bound exclusive. |
| 102 | */ |
| 103 | static final long MAXIMUM_TIMESTAMP_IN_MILLIS = 253402300800000L; |
| 104 | |
| 105 | /** |
| 106 | * 10000T in millis, upper bound exclusive. |
| 107 | */ |
| 108 | static final BigDecimal MAXIMUM_ALLOWED_TIMESTAMP_IN_MILLIS_DECIMAL = new BigDecimal(MAXIMUM_TIMESTAMP_IN_MILLIS); |
| 109 | |
| 110 | |
| 111 | /** |
| 112 | * 0001-01-01T00:00:00.0Z epoch seconds. |
| 113 | */ |
| 114 | static final long MINIMUM_TIMESTAMP_IN_EPOCH_SECONDS = MINIMUM_TIMESTAMP_IN_MILLIS / 1000; |
| 115 | |
| 116 | /** |
| 117 | * 10000T in epoch seconds, upper bound exclusive. |
| 118 | */ |
| 119 | static final long MAXIMUM_TIMESTAMP_IN_EPOCH_SECONDS = MAXIMUM_TIMESTAMP_IN_MILLIS / 1000; |
| 120 | |
| 121 | /** |
| 122 | * Unknown local offset from UTC. |
| 123 | */ |
| 124 | public static final Integer UNKNOWN_OFFSET = null; |
| 125 | |
| 126 | /** |
| 127 | * Local offset of zero hours from UTC. |
| 128 | */ |
| 129 | public static final Integer UTC_OFFSET = Integer.valueOf(0); |
| 130 | |
| 131 | private static final int FLAG_YEAR = 0x01; |
| 132 | private static final int FLAG_MONTH = 0x02; |