MCPcopy Create free account
hub / github.com/MenoData/Time4J / ZonalDateTime

Class ZonalDateTime

base/src/main/java/net/time4j/ZonalDateTime.java:107–738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105 * @see Moment#inZonalView(String)
106 */
107public final class ZonalDateTime
108 implements ChronoDisplay, UniversalTime, ThreetenAdapter {
109
110 //~ Instanzvariablen --------------------------------------------------
111
112 private final Moment moment;
113 private final Timezone zone;
114 private transient final PlainTimestamp timestamp;
115
116 //~ Konstruktoren -----------------------------------------------------
117
118 private ZonalDateTime(
119 Moment moment,
120 Timezone tz
121 ) {
122 super();
123
124 this.zone = tz;
125 ZonalOffset offset = tz.getOffset(moment);
126
127 if (moment.isLeapSecond()) {
128 if (
129 (offset.getFractionalAmount() != 0)
130 || ((offset.getAbsoluteSeconds() % 60) != 0)
131 ) {
132 throw new IllegalArgumentException(
133 "Leap second can only be represented "
134 + " with timezone-offset in full minutes: "
135 + offset);
136 }
137 }
138
139 this.moment = moment;
140 this.timestamp = PlainTimestamp.from(moment, offset);
141
142 }
143
144 private ZonalDateTime(
145 PlainTimestamp tsp,
146 ZonalOffset offset
147 ) {
148 super();
149
150 this.moment = tsp.at(offset);
151 this.zone = Timezone.of(offset);
152 this.timestamp = tsp;
153
154 }
155
156 //~ Methoden ----------------------------------------------------------
157
158 /**
159 * <p>Erzeugt einen zonalen Moment. </p>
160 *
161 * @param moment global timestamp
162 * @param tz timezone
163 * @return ZonalDateTime
164 * @throws IllegalArgumentException if leapsecond shall be formatted

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected