1 /*
2 * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
83 import java.time.temporal.TemporalAccessor;
84 import java.time.temporal.TemporalAdjuster;
85 import java.time.temporal.TemporalAmount;
86 import java.time.temporal.TemporalField;
87 import java.time.temporal.TemporalQueries;
88 import java.time.temporal.TemporalQuery;
89 import java.time.temporal.TemporalUnit;
90 import java.time.temporal.UnsupportedTemporalTypeException;
91 import java.time.temporal.ValueRange;
92 import java.time.zone.ZoneRules;
93 import java.util.Objects;
94
95 /**
96 * A time with an offset from UTC/Greenwich in the ISO-8601 calendar system,
97 * such as {@code 10:15:30+01:00}.
98 * <p>
99 * {@code OffsetTime} is an immutable date-time object that represents a time, often
100 * viewed as hour-minute-second-offset.
101 * This class stores all time fields, to a precision of nanoseconds,
102 * as well as a zone offset.
103 * For example, the value "13:45.30.123456789+02:00" can be stored
104 * in an {@code OffsetTime}.
105 *
106 * <p>
107 * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
108 * class; use of identity-sensitive operations (including reference equality
109 * ({@code ==}), identity hash code, or synchronization) on instances of
110 * {@code OffsetTime} may have unpredictable results and should be avoided.
111 * The {@code equals} method should be used for comparisons.
112 *
113 * @implSpec
114 * This class is immutable and thread-safe.
115 *
116 * @since 1.8
117 */
118 public final class OffsetTime
119 implements Temporal, TemporalAdjuster, Comparable<OffsetTime>, Serializable {
120
121 /**
122 * The minimum supported {@code OffsetTime}, '00:00:00+18:00'.
123 * This is the time of midnight at the start of the day in the maximum offset
|
1 /*
2 * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
83 import java.time.temporal.TemporalAccessor;
84 import java.time.temporal.TemporalAdjuster;
85 import java.time.temporal.TemporalAmount;
86 import java.time.temporal.TemporalField;
87 import java.time.temporal.TemporalQueries;
88 import java.time.temporal.TemporalQuery;
89 import java.time.temporal.TemporalUnit;
90 import java.time.temporal.UnsupportedTemporalTypeException;
91 import java.time.temporal.ValueRange;
92 import java.time.zone.ZoneRules;
93 import java.util.Objects;
94
95 /**
96 * A time with an offset from UTC/Greenwich in the ISO-8601 calendar system,
97 * such as {@code 10:15:30+01:00}.
98 * <p>
99 * {@code OffsetTime} is an immutable date-time object that represents a time, often
100 * viewed as hour-minute-second-offset.
101 * This class stores all time fields, to a precision of nanoseconds,
102 * as well as a zone offset.
103 * For example, the value "13:45:30.123456789+02:00" can be stored
104 * in an {@code OffsetTime}.
105 *
106 * <p>
107 * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
108 * class; use of identity-sensitive operations (including reference equality
109 * ({@code ==}), identity hash code, or synchronization) on instances of
110 * {@code OffsetTime} may have unpredictable results and should be avoided.
111 * The {@code equals} method should be used for comparisons.
112 *
113 * @implSpec
114 * This class is immutable and thread-safe.
115 *
116 * @since 1.8
117 */
118 public final class OffsetTime
119 implements Temporal, TemporalAdjuster, Comparable<OffsetTime>, Serializable {
120
121 /**
122 * The minimum supported {@code OffsetTime}, '00:00:00+18:00'.
123 * This is the time of midnight at the start of the day in the maximum offset
|