]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
b75a7d8f | 3 | /* |
46f4442e | 4 | ******************************************************************************** |
51004dcb | 5 | * Copyright (C) 1997-2013, International Business Machines * |
46f4442e A |
6 | * Corporation and others. All Rights Reserved. * |
7 | ******************************************************************************** | |
8 | * | |
9 | * File SIMPLETZ.H | |
10 | * | |
11 | * Modification History: | |
12 | * | |
13 | * Date Name Description | |
14 | * 04/21/97 aliu Overhauled header. | |
15 | * 08/10/98 stephen JDK 1.2 sync | |
16 | * Added setStartRule() / setEndRule() overloads | |
17 | * Added hasSameRules() | |
18 | * 09/02/98 stephen Added getOffset(monthLen) | |
19 | * Changed getOffset() to take UErrorCode | |
20 | * 07/09/99 stephen Removed millisPerHour (unused, for HP compiler) | |
21 | * 12/02/99 aliu Added TimeMode and constructor and setStart/EndRule | |
22 | * methods that take TimeMode. Added to docs. | |
23 | ******************************************************************************** | |
24 | */ | |
b75a7d8f A |
25 | |
26 | #ifndef SIMPLETZ_H | |
27 | #define SIMPLETZ_H | |
28 | ||
29 | #include "unicode/utypes.h" | |
30 | ||
340931cb A |
31 | #if U_SHOW_CPLUSPLUS_API |
32 | ||
73c04bcf A |
33 | /** |
34 | * \file | |
35 | * \brief C++ API: SimpleTimeZone is a concrete subclass of TimeZone. | |
36 | */ | |
37 | ||
b75a7d8f A |
38 | #if !UCONFIG_NO_FORMATTING |
39 | ||
46f4442e | 40 | #include "unicode/basictz.h" |
b75a7d8f | 41 | |
b75a7d8f A |
42 | U_NAMESPACE_BEGIN |
43 | ||
46f4442e A |
44 | // forward declaration |
45 | class InitialTimeZoneRule; | |
46 | class TimeZoneTransition; | |
47 | class AnnualTimeZoneRule; | |
48 | ||
b75a7d8f A |
49 | /** |
50 | * <code>SimpleTimeZone</code> is a concrete subclass of <code>TimeZone</code> | |
51 | * that represents a time zone for use with a Gregorian calendar. This | |
52 | * class does not handle historical changes. | |
53 | * <P> | |
54 | * When specifying daylight-savings-time begin and end dates, use a negative value for | |
55 | * <code>dayOfWeekInMonth</code> to indicate that <code>SimpleTimeZone</code> should | |
729e4ab9 A |
56 | * count from the end of the month backwards. For example, if Daylight Savings |
57 | * Time starts or ends at the last Sunday a month, use <code>dayOfWeekInMonth = -1</code> | |
58 | * along with <code>dayOfWeek = UCAL_SUNDAY</code> to specify the rule. | |
b75a7d8f A |
59 | * |
60 | * @see Calendar | |
61 | * @see GregorianCalendar | |
62 | * @see TimeZone | |
63 | * @author D. Goldsmith, Mark Davis, Chen-Lieh Huang, Alan Liu | |
64 | */ | |
46f4442e | 65 | class U_I18N_API SimpleTimeZone: public BasicTimeZone { |
b75a7d8f A |
66 | public: |
67 | ||
68 | /** | |
69 | * TimeMode is used, together with a millisecond offset after | |
70 | * midnight, to specify a rule transition time. Most rules | |
71 | * transition at a local wall time, that is, according to the | |
72 | * current time in effect, either standard, or DST. However, some | |
73 | * rules transition at local standard time, and some at a specific | |
74 | * UTC time. Although it might seem that all times could be | |
75 | * converted to wall time, thus eliminating the need for this | |
76 | * parameter, this is not the case. | |
77 | * @stable ICU 2.0 | |
78 | */ | |
79 | enum TimeMode { | |
80 | WALL_TIME = 0, | |
81 | STANDARD_TIME, | |
82 | UTC_TIME | |
83 | }; | |
84 | ||
85 | /** | |
86 | * Copy constructor | |
87 | * @param source the object to be copied. | |
88 | * @stable ICU 2.0 | |
89 | */ | |
90 | SimpleTimeZone(const SimpleTimeZone& source); | |
91 | ||
92 | /** | |
93 | * Default assignment operator | |
94 | * @param right the object to be copied. | |
95 | * @stable ICU 2.0 | |
96 | */ | |
97 | SimpleTimeZone& operator=(const SimpleTimeZone& right); | |
98 | ||
99 | /** | |
100 | * Destructor | |
101 | * @stable ICU 2.0 | |
102 | */ | |
103 | virtual ~SimpleTimeZone(); | |
104 | ||
105 | /** | |
106 | * Returns true if the two TimeZone objects are equal; that is, they have | |
107 | * the same ID, raw GMT offset, and DST rules. | |
108 | * | |
109 | * @param that The SimpleTimeZone object to be compared with. | |
110 | * @return True if the given time zone is equal to this time zone; false | |
111 | * otherwise. | |
112 | * @stable ICU 2.0 | |
113 | */ | |
114 | virtual UBool operator==(const TimeZone& that) const; | |
115 | ||
116 | /** | |
117 | * Constructs a SimpleTimeZone with the given raw GMT offset and time zone ID, | |
118 | * and which doesn't observe daylight savings time. Normally you should use | |
119 | * TimeZone::createInstance() to create a TimeZone instead of creating a | |
120 | * SimpleTimeZone directly with this constructor. | |
121 | * | |
122 | * @param rawOffsetGMT The given base time zone offset to GMT. | |
123 | * @param ID The timezone ID which is obtained from | |
124 | * TimeZone.getAvailableIDs. | |
125 | * @stable ICU 2.0 | |
126 | */ | |
127 | SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID); | |
128 | ||
129 | /** | |
130 | * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID, | |
131 | * and times to start and end daylight savings time. To create a TimeZone that | |
132 | * doesn't observe daylight savings time, don't use this constructor; use | |
133 | * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use | |
134 | * TimeZone.createInstance() to create a TimeZone instead of creating a | |
135 | * SimpleTimeZone directly with this constructor. | |
136 | * <P> | |
137 | * Various types of daylight-savings time rules can be specfied by using different | |
138 | * values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a | |
139 | * complete explanation of how these parameters work, see the documentation for | |
140 | * setStartRule(). | |
141 | * | |
142 | * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset | |
143 | * @param ID The new SimpleTimeZone's time zone ID. | |
144 | * @param savingsStartMonth The daylight savings starting month. Month is | |
145 | * 0-based. eg, 0 for January. | |
146 | * @param savingsStartDayOfWeekInMonth The daylight savings starting | |
147 | * day-of-week-in-month. See setStartRule() for a | |
148 | * complete explanation. | |
149 | * @param savingsStartDayOfWeek The daylight savings starting day-of-week. | |
150 | * See setStartRule() for a complete explanation. | |
151 | * @param savingsStartTime The daylight savings starting time, expressed as the | |
152 | * number of milliseconds after midnight. | |
153 | * @param savingsEndMonth The daylight savings ending month. Month is | |
154 | * 0-based. eg, 0 for January. | |
155 | * @param savingsEndDayOfWeekInMonth The daylight savings ending day-of-week-in-month. | |
156 | * See setStartRule() for a complete explanation. | |
157 | * @param savingsEndDayOfWeek The daylight savings ending day-of-week. | |
158 | * See setStartRule() for a complete explanation. | |
159 | * @param savingsEndTime The daylight savings ending time, expressed as the | |
160 | * number of milliseconds after midnight. | |
161 | * @param status An UErrorCode to receive the status. | |
162 | * @stable ICU 2.0 | |
163 | */ | |
164 | SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID, | |
165 | int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth, | |
166 | int8_t savingsStartDayOfWeek, int32_t savingsStartTime, | |
167 | int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth, | |
168 | int8_t savingsEndDayOfWeek, int32_t savingsEndTime, | |
169 | UErrorCode& status); | |
170 | /** | |
171 | * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID, | |
172 | * and times to start and end daylight savings time. To create a TimeZone that | |
173 | * doesn't observe daylight savings time, don't use this constructor; use | |
174 | * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use | |
175 | * TimeZone.createInstance() to create a TimeZone instead of creating a | |
176 | * SimpleTimeZone directly with this constructor. | |
177 | * <P> | |
178 | * Various types of daylight-savings time rules can be specfied by using different | |
179 | * values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a | |
180 | * complete explanation of how these parameters work, see the documentation for | |
181 | * setStartRule(). | |
182 | * | |
183 | * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset | |
184 | * @param ID The new SimpleTimeZone's time zone ID. | |
185 | * @param savingsStartMonth The daylight savings starting month. Month is | |
186 | * 0-based. eg, 0 for January. | |
187 | * @param savingsStartDayOfWeekInMonth The daylight savings starting | |
188 | * day-of-week-in-month. See setStartRule() for a | |
189 | * complete explanation. | |
190 | * @param savingsStartDayOfWeek The daylight savings starting day-of-week. | |
191 | * See setStartRule() for a complete explanation. | |
192 | * @param savingsStartTime The daylight savings starting time, expressed as the | |
193 | * number of milliseconds after midnight. | |
194 | * @param savingsEndMonth The daylight savings ending month. Month is | |
195 | * 0-based. eg, 0 for January. | |
196 | * @param savingsEndDayOfWeekInMonth The daylight savings ending day-of-week-in-month. | |
197 | * See setStartRule() for a complete explanation. | |
198 | * @param savingsEndDayOfWeek The daylight savings ending day-of-week. | |
199 | * See setStartRule() for a complete explanation. | |
200 | * @param savingsEndTime The daylight savings ending time, expressed as the | |
201 | * number of milliseconds after midnight. | |
202 | * @param savingsDST The number of milliseconds added to standard time | |
203 | * to get DST time. Default is one hour. | |
204 | * @param status An UErrorCode to receive the status. | |
205 | * @stable ICU 2.0 | |
206 | */ | |
207 | SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID, | |
208 | int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth, | |
209 | int8_t savingsStartDayOfWeek, int32_t savingsStartTime, | |
210 | int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth, | |
211 | int8_t savingsEndDayOfWeek, int32_t savingsEndTime, | |
212 | int32_t savingsDST, UErrorCode& status); | |
213 | ||
214 | /** | |
215 | * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID, | |
216 | * and times to start and end daylight savings time. To create a TimeZone that | |
217 | * doesn't observe daylight savings time, don't use this constructor; use | |
218 | * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use | |
219 | * TimeZone.createInstance() to create a TimeZone instead of creating a | |
220 | * SimpleTimeZone directly with this constructor. | |
221 | * <P> | |
222 | * Various types of daylight-savings time rules can be specfied by using different | |
223 | * values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a | |
224 | * complete explanation of how these parameters work, see the documentation for | |
225 | * setStartRule(). | |
226 | * | |
227 | * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset | |
228 | * @param ID The new SimpleTimeZone's time zone ID. | |
229 | * @param savingsStartMonth The daylight savings starting month. Month is | |
230 | * 0-based. eg, 0 for January. | |
231 | * @param savingsStartDayOfWeekInMonth The daylight savings starting | |
232 | * day-of-week-in-month. See setStartRule() for a | |
233 | * complete explanation. | |
234 | * @param savingsStartDayOfWeek The daylight savings starting day-of-week. | |
235 | * See setStartRule() for a complete explanation. | |
236 | * @param savingsStartTime The daylight savings starting time, expressed as the | |
237 | * number of milliseconds after midnight. | |
238 | * @param savingsStartTimeMode Whether the start time is local wall time, local | |
239 | * standard time, or UTC time. Default is local wall time. | |
240 | * @param savingsEndMonth The daylight savings ending month. Month is | |
241 | * 0-based. eg, 0 for January. | |
242 | * @param savingsEndDayOfWeekInMonth The daylight savings ending day-of-week-in-month. | |
243 | * See setStartRule() for a complete explanation. | |
244 | * @param savingsEndDayOfWeek The daylight savings ending day-of-week. | |
245 | * See setStartRule() for a complete explanation. | |
246 | * @param savingsEndTime The daylight savings ending time, expressed as the | |
247 | * number of milliseconds after midnight. | |
248 | * @param savingsEndTimeMode Whether the end time is local wall time, local | |
249 | * standard time, or UTC time. Default is local wall time. | |
250 | * @param savingsDST The number of milliseconds added to standard time | |
251 | * to get DST time. Default is one hour. | |
252 | * @param status An UErrorCode to receive the status. | |
253 | * @stable ICU 2.0 | |
254 | */ | |
255 | SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID, | |
256 | int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth, | |
257 | int8_t savingsStartDayOfWeek, int32_t savingsStartTime, | |
258 | TimeMode savingsStartTimeMode, | |
259 | int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth, | |
260 | int8_t savingsEndDayOfWeek, int32_t savingsEndTime, TimeMode savingsEndTimeMode, | |
261 | int32_t savingsDST, UErrorCode& status); | |
262 | ||
263 | /** | |
264 | * Sets the daylight savings starting year, that is, the year this time zone began | |
265 | * observing its specified daylight savings time rules. The time zone is considered | |
266 | * not to observe daylight savings time prior to that year; SimpleTimeZone doesn't | |
267 | * support historical daylight-savings-time rules. | |
268 | * @param year the daylight savings starting year. | |
269 | * @stable ICU 2.0 | |
270 | */ | |
271 | void setStartYear(int32_t year); | |
272 | ||
273 | /** | |
274 | * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings | |
729e4ab9 | 275 | * Time starts at the second Sunday in March, at 2 AM in standard time. |
b75a7d8f | 276 | * Therefore, you can set the start rule by calling: |
729e4ab9 | 277 | * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000); |
b75a7d8f A |
278 | * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate |
279 | * the exact starting date. Their exact meaning depend on their respective signs, | |
374ca955 A |
280 | * allowing various types of rules to be constructed, as follows: |
281 | * <ul> | |
b75a7d8f A |
282 | * <li>If both dayOfWeekInMonth and dayOfWeek are positive, they specify the |
283 | * day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday | |
374ca955 | 284 | * of the month).</li> |
b75a7d8f A |
285 | * <li>If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify |
286 | * the day of week in the month counting backward from the end of the month. | |
374ca955 | 287 | * (e.g., (-1, MONDAY) is the last Monday in the month)</li> |
b75a7d8f A |
288 | * <li>If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth |
289 | * specifies the day of the month, regardless of what day of the week it is. | |
374ca955 | 290 | * (e.g., (10, 0) is the tenth day of the month)</li> |
b75a7d8f A |
291 | * <li>If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth |
292 | * specifies the day of the month counting backward from the end of the | |
293 | * month, regardless of what day of the week it is (e.g., (-2, 0) is the | |
374ca955 | 294 | * next-to-last day of the month).</li> |
b75a7d8f A |
295 | * <li>If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the |
296 | * first specified day of the week on or after the specfied day of the month. | |
297 | * (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month | |
374ca955 | 298 | * [or the 15th itself if the 15th is a Sunday].)</li> |
b75a7d8f A |
299 | * <li>If dayOfWeek and DayOfWeekInMonth are both negative, they specify the |
300 | * last specified day of the week on or before the specified day of the month. | |
301 | * (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month | |
374ca955 A |
302 | * [or the 20th itself if the 20th is a Tuesday].)</li> |
303 | * </ul> | |
b75a7d8f A |
304 | * @param month the daylight savings starting month. Month is 0-based. |
305 | * eg, 0 for January. | |
306 | * @param dayOfWeekInMonth the daylight savings starting | |
307 | * day-of-week-in-month. Please see the member description for an example. | |
308 | * @param dayOfWeek the daylight savings starting day-of-week. Please see | |
309 | * the member description for an example. | |
310 | * @param time the daylight savings starting time. Please see the member | |
311 | * description for an example. | |
312 | * @param status An UErrorCode | |
313 | * @stable ICU 2.0 | |
314 | */ | |
315 | void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, | |
316 | int32_t time, UErrorCode& status); | |
317 | /** | |
318 | * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings | |
729e4ab9 | 319 | * Time starts at the second Sunday in March, at 2 AM in standard time. |
b75a7d8f | 320 | * Therefore, you can set the start rule by calling: |
729e4ab9 | 321 | * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000); |
b75a7d8f A |
322 | * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate |
323 | * the exact starting date. Their exact meaning depend on their respective signs, | |
374ca955 A |
324 | * allowing various types of rules to be constructed, as follows: |
325 | * <ul> | |
b75a7d8f A |
326 | * <li>If both dayOfWeekInMonth and dayOfWeek are positive, they specify the |
327 | * day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday | |
374ca955 | 328 | * of the month).</li> |
b75a7d8f A |
329 | * <li>If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify |
330 | * the day of week in the month counting backward from the end of the month. | |
374ca955 | 331 | * (e.g., (-1, MONDAY) is the last Monday in the month)</li> |
b75a7d8f A |
332 | * <li>If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth |
333 | * specifies the day of the month, regardless of what day of the week it is. | |
374ca955 | 334 | * (e.g., (10, 0) is the tenth day of the month)</li> |
b75a7d8f A |
335 | * <li>If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth |
336 | * specifies the day of the month counting backward from the end of the | |
337 | * month, regardless of what day of the week it is (e.g., (-2, 0) is the | |
374ca955 | 338 | * next-to-last day of the month).</li> |
b75a7d8f A |
339 | * <li>If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the |
340 | * first specified day of the week on or after the specfied day of the month. | |
341 | * (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month | |
374ca955 | 342 | * [or the 15th itself if the 15th is a Sunday].)</li> |
b75a7d8f A |
343 | * <li>If dayOfWeek and DayOfWeekInMonth are both negative, they specify the |
344 | * last specified day of the week on or before the specified day of the month. | |
345 | * (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month | |
374ca955 A |
346 | * [or the 20th itself if the 20th is a Tuesday].)</li> |
347 | * </ul> | |
b75a7d8f A |
348 | * @param month the daylight savings starting month. Month is 0-based. |
349 | * eg, 0 for January. | |
350 | * @param dayOfWeekInMonth the daylight savings starting | |
351 | * day-of-week-in-month. Please see the member description for an example. | |
352 | * @param dayOfWeek the daylight savings starting day-of-week. Please see | |
353 | * the member description for an example. | |
354 | * @param time the daylight savings starting time. Please see the member | |
355 | * description for an example. | |
356 | * @param mode whether the time is local wall time, local standard time, | |
357 | * or UTC time. Default is local wall time. | |
358 | * @param status An UErrorCode | |
359 | * @stable ICU 2.0 | |
360 | */ | |
361 | void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, | |
362 | int32_t time, TimeMode mode, UErrorCode& status); | |
363 | ||
364 | /** | |
365 | * Sets the DST start rule to a fixed date within a month. | |
366 | * | |
367 | * @param month The month in which this rule occurs (0-based). | |
368 | * @param dayOfMonth The date in that month (1-based). | |
369 | * @param time The time of that day (number of millis after midnight) | |
370 | * when DST takes effect in local wall time, which is | |
371 | * standard time in this case. | |
372 | * @param status An UErrorCode | |
373 | * @stable ICU 2.0 | |
374 | */ | |
375 | void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time, | |
376 | UErrorCode& status); | |
377 | /** | |
378 | * Sets the DST start rule to a fixed date within a month. | |
379 | * | |
380 | * @param month The month in which this rule occurs (0-based). | |
381 | * @param dayOfMonth The date in that month (1-based). | |
382 | * @param time The time of that day (number of millis after midnight) | |
383 | * when DST takes effect in local wall time, which is | |
384 | * standard time in this case. | |
385 | * @param mode whether the time is local wall time, local standard time, | |
386 | * or UTC time. Default is local wall time. | |
387 | * @param status An UErrorCode | |
388 | * @stable ICU 2.0 | |
389 | */ | |
390 | void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time, | |
391 | TimeMode mode, UErrorCode& status); | |
392 | ||
393 | /** | |
394 | * Sets the DST start rule to a weekday before or after a give date within | |
395 | * a month, e.g., the first Monday on or after the 8th. | |
396 | * | |
397 | * @param month The month in which this rule occurs (0-based). | |
398 | * @param dayOfMonth A date within that month (1-based). | |
399 | * @param dayOfWeek The day of the week on which this rule occurs. | |
400 | * @param time The time of that day (number of millis after midnight) | |
401 | * when DST takes effect in local wall time, which is | |
402 | * standard time in this case. | |
403 | * @param after If true, this rule selects the first dayOfWeek on | |
404 | * or after dayOfMonth. If false, this rule selects | |
405 | * the last dayOfWeek on or before dayOfMonth. | |
406 | * @param status An UErrorCode | |
407 | * @stable ICU 2.0 | |
408 | */ | |
409 | void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, | |
410 | int32_t time, UBool after, UErrorCode& status); | |
411 | /** | |
412 | * Sets the DST start rule to a weekday before or after a give date within | |
413 | * a month, e.g., the first Monday on or after the 8th. | |
414 | * | |
415 | * @param month The month in which this rule occurs (0-based). | |
416 | * @param dayOfMonth A date within that month (1-based). | |
417 | * @param dayOfWeek The day of the week on which this rule occurs. | |
418 | * @param time The time of that day (number of millis after midnight) | |
419 | * when DST takes effect in local wall time, which is | |
420 | * standard time in this case. | |
421 | * @param mode whether the time is local wall time, local standard time, | |
422 | * or UTC time. Default is local wall time. | |
423 | * @param after If true, this rule selects the first dayOfWeek on | |
424 | * or after dayOfMonth. If false, this rule selects | |
425 | * the last dayOfWeek on or before dayOfMonth. | |
426 | * @param status An UErrorCode | |
427 | * @stable ICU 2.0 | |
428 | */ | |
429 | void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, | |
430 | int32_t time, TimeMode mode, UBool after, UErrorCode& status); | |
431 | ||
432 | /** | |
729e4ab9 | 433 | * Sets the daylight savings ending rule. For example, if Daylight |
b75a7d8f A |
434 | * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time. |
435 | * Therefore, you can set the end rule by calling: | |
436 | * <pre> | |
729e4ab9 | 437 | * setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000); |
b75a7d8f A |
438 | * </pre> |
439 | * Various other types of rules can be specified by manipulating the dayOfWeek | |
440 | * and dayOfWeekInMonth parameters. For complete details, see the documentation | |
441 | * for setStartRule(). | |
442 | * | |
443 | * @param month the daylight savings ending month. Month is 0-based. | |
444 | * eg, 0 for January. | |
445 | * @param dayOfWeekInMonth the daylight savings ending | |
446 | * day-of-week-in-month. See setStartRule() for a complete explanation. | |
447 | * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule() | |
448 | * for a complete explanation. | |
449 | * @param time the daylight savings ending time. Please see the member | |
450 | * description for an example. | |
451 | * @param status An UErrorCode | |
452 | * @stable ICU 2.0 | |
453 | */ | |
454 | void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, | |
455 | int32_t time, UErrorCode& status); | |
456 | ||
457 | /** | |
729e4ab9 | 458 | * Sets the daylight savings ending rule. For example, if Daylight |
b75a7d8f A |
459 | * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time. |
460 | * Therefore, you can set the end rule by calling: | |
461 | * <pre> | |
729e4ab9 | 462 | * setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000); |
b75a7d8f A |
463 | * </pre> |
464 | * Various other types of rules can be specified by manipulating the dayOfWeek | |
465 | * and dayOfWeekInMonth parameters. For complete details, see the documentation | |
466 | * for setStartRule(). | |
467 | * | |
468 | * @param month the daylight savings ending month. Month is 0-based. | |
469 | * eg, 0 for January. | |
470 | * @param dayOfWeekInMonth the daylight savings ending | |
471 | * day-of-week-in-month. See setStartRule() for a complete explanation. | |
472 | * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule() | |
473 | * for a complete explanation. | |
474 | * @param time the daylight savings ending time. Please see the member | |
475 | * description for an example. | |
476 | * @param mode whether the time is local wall time, local standard time, | |
477 | * or UTC time. Default is local wall time. | |
478 | * @param status An UErrorCode | |
479 | * @stable ICU 2.0 | |
480 | */ | |
481 | void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, | |
482 | int32_t time, TimeMode mode, UErrorCode& status); | |
483 | ||
484 | /** | |
485 | * Sets the DST end rule to a fixed date within a month. | |
486 | * | |
487 | * @param month The month in which this rule occurs (0-based). | |
488 | * @param dayOfMonth The date in that month (1-based). | |
489 | * @param time The time of that day (number of millis after midnight) | |
490 | * when DST ends in local wall time, which is daylight | |
491 | * time in this case. | |
492 | * @param status An UErrorCode | |
493 | * @stable ICU 2.0 | |
494 | */ | |
495 | void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time, UErrorCode& status); | |
496 | ||
497 | /** | |
498 | * Sets the DST end rule to a fixed date within a month. | |
499 | * | |
500 | * @param month The month in which this rule occurs (0-based). | |
501 | * @param dayOfMonth The date in that month (1-based). | |
502 | * @param time The time of that day (number of millis after midnight) | |
503 | * when DST ends in local wall time, which is daylight | |
504 | * time in this case. | |
505 | * @param mode whether the time is local wall time, local standard time, | |
506 | * or UTC time. Default is local wall time. | |
507 | * @param status An UErrorCode | |
508 | * @stable ICU 2.0 | |
509 | */ | |
510 | void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time, | |
511 | TimeMode mode, UErrorCode& status); | |
512 | ||
513 | /** | |
514 | * Sets the DST end rule to a weekday before or after a give date within | |
515 | * a month, e.g., the first Monday on or after the 8th. | |
516 | * | |
517 | * @param month The month in which this rule occurs (0-based). | |
518 | * @param dayOfMonth A date within that month (1-based). | |
519 | * @param dayOfWeek The day of the week on which this rule occurs. | |
520 | * @param time The time of that day (number of millis after midnight) | |
521 | * when DST ends in local wall time, which is daylight | |
522 | * time in this case. | |
523 | * @param after If true, this rule selects the first dayOfWeek on | |
524 | * or after dayOfMonth. If false, this rule selects | |
525 | * the last dayOfWeek on or before dayOfMonth. | |
526 | * @param status An UErrorCode | |
527 | * @stable ICU 2.0 | |
528 | */ | |
529 | void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, | |
530 | int32_t time, UBool after, UErrorCode& status); | |
531 | ||
532 | /** | |
533 | * Sets the DST end rule to a weekday before or after a give date within | |
534 | * a month, e.g., the first Monday on or after the 8th. | |
535 | * | |
536 | * @param month The month in which this rule occurs (0-based). | |
537 | * @param dayOfMonth A date within that month (1-based). | |
538 | * @param dayOfWeek The day of the week on which this rule occurs. | |
539 | * @param time The time of that day (number of millis after midnight) | |
540 | * when DST ends in local wall time, which is daylight | |
541 | * time in this case. | |
542 | * @param mode whether the time is local wall time, local standard time, | |
543 | * or UTC time. Default is local wall time. | |
544 | * @param after If true, this rule selects the first dayOfWeek on | |
545 | * or after dayOfMonth. If false, this rule selects | |
546 | * the last dayOfWeek on or before dayOfMonth. | |
547 | * @param status An UErrorCode | |
548 | * @stable ICU 2.0 | |
549 | */ | |
550 | void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, | |
551 | int32_t time, TimeMode mode, UBool after, UErrorCode& status); | |
552 | ||
553 | /** | |
554 | * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add | |
555 | * to GMT to get local time in this time zone, taking daylight savings time into | |
556 | * account) as of a particular reference date. The reference date is used to determine | |
557 | * whether daylight savings time is in effect and needs to be figured into the offset | |
558 | * that is returned (in other words, what is the adjusted GMT offset in this time zone | |
559 | * at this particular date and time?). For the time zones produced by createTimeZone(), | |
560 | * the reference data is specified according to the Gregorian calendar, and the date | |
561 | * and time fields are in GMT, NOT local time. | |
562 | * | |
563 | * @param era The reference date's era | |
564 | * @param year The reference date's year | |
565 | * @param month The reference date's month (0-based; 0 is January) | |
566 | * @param day The reference date's day-in-month (1-based) | |
567 | * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) | |
568 | * @param millis The reference date's milliseconds in day, UTT (NOT local time). | |
569 | * @param status An UErrorCode to receive the status. | |
570 | * @return The offset in milliseconds to add to GMT to get local time. | |
571 | * @stable ICU 2.0 | |
572 | */ | |
573 | virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, | |
574 | uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const; | |
575 | ||
576 | /** | |
577 | * Gets the time zone offset, for current date, modified in case of | |
578 | * daylight savings. This is the offset to add *to* UTC to get local time. | |
579 | * @param era the era of the given date. | |
580 | * @param year the year in the given date. | |
581 | * @param month the month in the given date. | |
582 | * Month is 0-based. e.g., 0 for January. | |
583 | * @param day the day-in-month of the given date. | |
584 | * @param dayOfWeek the day-of-week of the given date. | |
585 | * @param milliseconds the millis in day in <em>standard</em> local time. | |
586 | * @param monthLength the length of the given month in days. | |
587 | * @param status An UErrorCode to receive the status. | |
588 | * @return the offset to add *to* GMT to get local time. | |
589 | * @stable ICU 2.0 | |
590 | */ | |
591 | virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, | |
592 | uint8_t dayOfWeek, int32_t milliseconds, | |
593 | int32_t monthLength, UErrorCode& status) const; | |
594 | /** | |
595 | * Gets the time zone offset, for current date, modified in case of | |
596 | * daylight savings. This is the offset to add *to* UTC to get local time. | |
597 | * @param era the era of the given date. | |
598 | * @param year the year in the given date. | |
599 | * @param month the month in the given date. | |
600 | * Month is 0-based. e.g., 0 for January. | |
601 | * @param day the day-in-month of the given date. | |
602 | * @param dayOfWeek the day-of-week of the given date. | |
603 | * @param milliseconds the millis in day in <em>standard</em> local time. | |
604 | * @param monthLength the length of the given month in days. | |
605 | * @param prevMonthLength length of the previous month in days. | |
606 | * @param status An UErrorCode to receive the status. | |
607 | * @return the offset to add *to* GMT to get local time. | |
608 | * @stable ICU 2.0 | |
609 | */ | |
610 | virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, | |
611 | uint8_t dayOfWeek, int32_t milliseconds, | |
612 | int32_t monthLength, int32_t prevMonthLength, | |
613 | UErrorCode& status) const; | |
614 | ||
374ca955 A |
615 | /** |
616 | * Redeclared TimeZone method. This implementation simply calls | |
617 | * the base class method, which otherwise would be hidden. | |
73c04bcf | 618 | * @stable ICU 2.8 |
374ca955 A |
619 | */ |
620 | virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, | |
621 | int32_t& dstOffset, UErrorCode& ec) const; | |
622 | ||
46f4442e A |
623 | /** |
624 | * Get time zone offsets from local wall time. | |
625 | * @internal | |
626 | */ | |
627 | virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, | |
51004dcb | 628 | int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const; |
46f4442e | 629 | |
b75a7d8f A |
630 | /** |
631 | * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add | |
632 | * to GMT to get local time, before taking daylight savings time into account). | |
633 | * | |
634 | * @return The TimeZone's raw GMT offset. | |
635 | * @stable ICU 2.0 | |
636 | */ | |
637 | virtual int32_t getRawOffset(void) const; | |
638 | ||
639 | /** | |
640 | * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add | |
641 | * to GMT to get local time, before taking daylight savings time into account). | |
642 | * | |
643 | * @param offsetMillis The new raw GMT offset for this time zone. | |
644 | * @stable ICU 2.0 | |
645 | */ | |
646 | virtual void setRawOffset(int32_t offsetMillis); | |
647 | ||
648 | /** | |
649 | * Sets the amount of time in ms that the clock is advanced during DST. | |
650 | * @param millisSavedDuringDST the number of milliseconds the time is | |
651 | * advanced with respect to standard time when the daylight savings rules | |
0f5d89e8 A |
652 | * are in effect. Typically one hour (+3600000). The amount could be negative, |
653 | * but not 0. | |
b75a7d8f A |
654 | * @param status An UErrorCode to receive the status. |
655 | * @stable ICU 2.0 | |
656 | */ | |
657 | void setDSTSavings(int32_t millisSavedDuringDST, UErrorCode& status); | |
658 | ||
659 | /** | |
660 | * Returns the amount of time in ms that the clock is advanced during DST. | |
661 | * @return the number of milliseconds the time is | |
662 | * advanced with respect to standard time when the daylight savings rules | |
0f5d89e8 A |
663 | * are in effect. Typically one hour (+3600000). The amount could be negative, |
664 | * but not 0. | |
b75a7d8f A |
665 | * @stable ICU 2.0 |
666 | */ | |
73c04bcf | 667 | virtual int32_t getDSTSavings(void) const; |
b75a7d8f A |
668 | |
669 | /** | |
670 | * Queries if this TimeZone uses Daylight Savings Time. | |
671 | * | |
672 | * @return True if this TimeZone uses Daylight Savings Time; false otherwise. | |
673 | * @stable ICU 2.0 | |
674 | */ | |
675 | virtual UBool useDaylightTime(void) const; | |
676 | ||
340931cb | 677 | #ifndef U_FORCE_HIDE_DEPRECATED_API |
b75a7d8f A |
678 | /** |
679 | * Returns true if the given date is within the period when daylight savings time | |
680 | * is in effect; false otherwise. If the TimeZone doesn't observe daylight savings | |
681 | * time, this functions always returns false. | |
682 | * This method is wasteful since it creates a new GregorianCalendar and | |
683 | * deletes it each time it is called. This is a deprecated method | |
684 | * and provided only for Java compatibility. | |
685 | * | |
686 | * @param date The date to test. | |
687 | * @param status An UErrorCode to receive the status. | |
688 | * @return true if the given date is in Daylight Savings Time; | |
689 | * false otherwise. | |
690 | * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. | |
691 | */ | |
692 | virtual UBool inDaylightTime(UDate date, UErrorCode& status) const; | |
340931cb | 693 | #endif // U_FORCE_HIDE_DEPRECATED_API |
b75a7d8f A |
694 | |
695 | /** | |
696 | * Return true if this zone has the same rules and offset as another zone. | |
697 | * @param other the TimeZone object to be compared with | |
698 | * @return true if the given zone has the same rules and offset as this one | |
699 | * @stable ICU 2.0 | |
700 | */ | |
701 | UBool hasSameRules(const TimeZone& other) const; | |
702 | ||
703 | /** | |
704 | * Clones TimeZone objects polymorphically. Clients are responsible for deleting | |
705 | * the TimeZone object cloned. | |
706 | * | |
707 | * @return A new copy of this TimeZone object. | |
708 | * @stable ICU 2.0 | |
709 | */ | |
340931cb | 710 | virtual SimpleTimeZone* clone() const; |
b75a7d8f | 711 | |
46f4442e A |
712 | /** |
713 | * Gets the first time zone transition after the base time. | |
714 | * @param base The base time. | |
715 | * @param inclusive Whether the base time is inclusive or not. | |
716 | * @param result Receives the first transition after the base time. | |
717 | * @return TRUE if the transition is found. | |
729e4ab9 | 718 | * @stable ICU 3.8 |
46f4442e | 719 | */ |
51004dcb | 720 | virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; |
46f4442e A |
721 | |
722 | /** | |
723 | * Gets the most recent time zone transition before the base time. | |
724 | * @param base The base time. | |
725 | * @param inclusive Whether the base time is inclusive or not. | |
726 | * @param result Receives the most recent transition before the base time. | |
727 | * @return TRUE if the transition is found. | |
729e4ab9 | 728 | * @stable ICU 3.8 |
46f4442e | 729 | */ |
51004dcb | 730 | virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; |
46f4442e A |
731 | |
732 | /** | |
733 | * Returns the number of <code>TimeZoneRule</code>s which represents time transitions, | |
734 | * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except | |
735 | * <code>InitialTimeZoneRule</code>. The return value range is 0 or any positive value. | |
736 | * @param status Receives error status code. | |
737 | * @return The number of <code>TimeZoneRule</code>s representing time transitions. | |
729e4ab9 | 738 | * @stable ICU 3.8 |
46f4442e | 739 | */ |
51004dcb | 740 | virtual int32_t countTransitionRules(UErrorCode& status) const; |
46f4442e A |
741 | |
742 | /** | |
743 | * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code> | |
744 | * which represent time transitions for this time zone. On successful return, | |
745 | * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and | |
746 | * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code> | |
747 | * instances up to the size specified by trscount. The results are referencing the | |
748 | * rule instance held by this time zone instance. Therefore, after this time zone | |
749 | * is destructed, they are no longer available. | |
750 | * @param initial Receives the initial timezone rule | |
751 | * @param trsrules Receives the timezone transition rules | |
752 | * @param trscount On input, specify the size of the array 'transitions' receiving | |
753 | * the timezone transition rules. On output, actual number of | |
754 | * rules filled in the array will be set. | |
755 | * @param status Receives error status code. | |
729e4ab9 | 756 | * @stable ICU 3.8 |
46f4442e A |
757 | */ |
758 | virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial, | |
51004dcb | 759 | const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const; |
46f4442e A |
760 | |
761 | ||
b75a7d8f A |
762 | public: |
763 | ||
764 | /** | |
765 | * Override TimeZone Returns a unique class ID POLYMORPHICALLY. Pure virtual | |
766 | * override. This method is to implement a simple version of RTTI, since not all C++ | |
767 | * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call | |
768 | * this method. | |
769 | * | |
770 | * @return The class ID for this object. All objects of a given class have the | |
771 | * same class ID. Objects of other classes have different class IDs. | |
772 | * @stable ICU 2.0 | |
773 | */ | |
774 | virtual UClassID getDynamicClassID(void) const; | |
775 | ||
776 | /** | |
777 | * Return the class ID for this class. This is useful only for comparing to a return | |
778 | * value from getDynamicClassID(). For example: | |
779 | * <pre> | |
780 | * . Base* polymorphic_pointer = createPolymorphicObject(); | |
781 | * . if (polymorphic_pointer->getDynamicClassID() == | |
782 | * . Derived::getStaticClassID()) ... | |
783 | * </pre> | |
784 | * @return The class ID for all objects of this class. | |
785 | * @stable ICU 2.0 | |
786 | */ | |
374ca955 | 787 | static UClassID U_EXPORT2 getStaticClassID(void); |
b75a7d8f A |
788 | |
789 | private: | |
790 | /** | |
791 | * Constants specifying values of startMode and endMode. | |
792 | */ | |
793 | enum EMode | |
794 | { | |
795 | DOM_MODE = 1, | |
796 | DOW_IN_MONTH_MODE, | |
797 | DOW_GE_DOM_MODE, | |
798 | DOW_LE_DOM_MODE | |
799 | }; | |
800 | ||
b75a7d8f A |
801 | SimpleTimeZone(); // default constructor not implemented |
802 | ||
b75a7d8f A |
803 | /** |
804 | * Internal construction method. | |
805 | * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset | |
806 | * @param startMonth the month DST starts | |
807 | * @param startDay the day DST starts | |
808 | * @param startDayOfWeek the DOW DST starts | |
809 | * @param startTime the time DST starts | |
810 | * @param startTimeMode Whether the start time is local wall time, local | |
811 | * standard time, or UTC time. Default is local wall time. | |
812 | * @param endMonth the month DST ends | |
813 | * @param endDay the day DST ends | |
814 | * @param endDayOfWeek the DOW DST ends | |
815 | * @param endTime the time DST ends | |
816 | * @param endTimeMode Whether the end time is local wall time, local | |
817 | * standard time, or UTC time. Default is local wall time. | |
4388f060 | 818 | * @param dstSavings The number of milliseconds added to standard time |
b75a7d8f A |
819 | * to get DST time. Default is one hour. |
820 | * @param status An UErrorCode to receive the status. | |
821 | */ | |
822 | void construct(int32_t rawOffsetGMT, | |
823 | int8_t startMonth, int8_t startDay, int8_t startDayOfWeek, | |
824 | int32_t startTime, TimeMode startTimeMode, | |
825 | int8_t endMonth, int8_t endDay, int8_t endDayOfWeek, | |
826 | int32_t endTime, TimeMode endTimeMode, | |
827 | int32_t dstSavings, UErrorCode& status); | |
828 | ||
829 | /** | |
830 | * Compare a given date in the year to a rule. Return 1, 0, or -1, depending | |
831 | * on whether the date is after, equal to, or before the rule date. The | |
832 | * millis are compared directly against the ruleMillis, so any | |
833 | * standard-daylight adjustments must be handled by the caller. | |
834 | * | |
835 | * @return 1 if the date is after the rule date, -1 if the date is before | |
836 | * the rule date, or 0 if the date is equal to the rule date. | |
837 | */ | |
838 | static int32_t compareToRule(int8_t month, int8_t monthLen, int8_t prevMonthLen, | |
839 | int8_t dayOfMonth, | |
840 | int8_t dayOfWeek, int32_t millis, int32_t millisDelta, | |
841 | EMode ruleMode, int8_t ruleMonth, int8_t ruleDayOfWeek, | |
842 | int8_t ruleDay, int32_t ruleMillis); | |
843 | ||
844 | /** | |
845 | * Given a set of encoded rules in startDay and startDayOfMonth, decode | |
846 | * them and set the startMode appropriately. Do the same for endDay and | |
847 | * endDayOfMonth. | |
848 | * <P> | |
849 | * Upon entry, the day of week variables may be zero or | |
850 | * negative, in order to indicate special modes. The day of month | |
851 | * variables may also be negative. | |
852 | * <P> | |
853 | * Upon exit, the mode variables will be | |
854 | * set, and the day of week and day of month variables will be positive. | |
855 | * <P> | |
856 | * This method also recognizes a startDay or endDay of zero as indicating | |
857 | * no DST. | |
858 | */ | |
859 | void decodeRules(UErrorCode& status); | |
860 | void decodeStartRule(UErrorCode& status); | |
861 | void decodeEndRule(UErrorCode& status); | |
862 | ||
b75a7d8f A |
863 | int8_t startMonth, startDay, startDayOfWeek; // the month, day, DOW, and time DST starts |
864 | int32_t startTime; | |
865 | TimeMode startTimeMode, endTimeMode; // Mode for startTime, endTime; see TimeMode | |
866 | int8_t endMonth, endDay, endDayOfWeek; // the month, day, DOW, and time DST ends | |
867 | int32_t endTime; | |
868 | int32_t startYear; // the year these DST rules took effect | |
869 | int32_t rawOffset; // the TimeZone's raw GMT offset | |
870 | UBool useDaylight; // flag indicating whether this TimeZone uses DST | |
374ca955 | 871 | static const int8_t STATICMONTHLENGTH[12]; // lengths of the months |
b75a7d8f A |
872 | EMode startMode, endMode; // flags indicating what kind of rules the DST rules are |
873 | ||
874 | /** | |
875 | * A positive value indicating the amount of time saved during DST in ms. | |
876 | * Typically one hour; sometimes 30 minutes. | |
877 | */ | |
878 | int32_t dstSavings; | |
46f4442e A |
879 | |
880 | /* Private for BasicTimeZone implementation */ | |
51004dcb | 881 | void checkTransitionRules(UErrorCode& status) const; |
46f4442e A |
882 | void initTransitionRules(UErrorCode& status); |
883 | void clearTransitionRules(void); | |
884 | void deleteTransitionRules(void); | |
885 | UBool transitionRulesInitialized; | |
886 | InitialTimeZoneRule* initialRule; | |
887 | TimeZoneTransition* firstTransition; | |
888 | AnnualTimeZoneRule* stdRule; | |
889 | AnnualTimeZoneRule* dstRule; | |
b75a7d8f A |
890 | }; |
891 | ||
b75a7d8f A |
892 | inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfWeekInMonth, |
893 | int32_t dayOfWeek, | |
894 | int32_t time, UErrorCode& status) { | |
895 | setStartRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status); | |
896 | } | |
897 | ||
898 | inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth, | |
899 | int32_t time, | |
900 | UErrorCode& status) { | |
901 | setStartRule(month, dayOfMonth, time, WALL_TIME, status); | |
902 | } | |
903 | ||
904 | inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth, | |
905 | int32_t dayOfWeek, | |
906 | int32_t time, UBool after, UErrorCode& status) { | |
907 | setStartRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status); | |
908 | } | |
909 | ||
910 | inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfWeekInMonth, | |
911 | int32_t dayOfWeek, | |
912 | int32_t time, UErrorCode& status) { | |
913 | setEndRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status); | |
914 | } | |
915 | ||
916 | inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth, | |
917 | int32_t time, UErrorCode& status) { | |
918 | setEndRule(month, dayOfMonth, time, WALL_TIME, status); | |
919 | } | |
920 | ||
921 | inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, | |
922 | int32_t time, UBool after, UErrorCode& status) { | |
923 | setEndRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status); | |
924 | } | |
925 | ||
374ca955 A |
926 | inline void |
927 | SimpleTimeZone::getOffset(UDate date, UBool local, int32_t& rawOffsetRef, | |
928 | int32_t& dstOffsetRef, UErrorCode& ec) const { | |
929 | TimeZone::getOffset(date, local, rawOffsetRef, dstOffsetRef, ec); | |
930 | } | |
931 | ||
b75a7d8f A |
932 | U_NAMESPACE_END |
933 | ||
934 | #endif /* #if !UCONFIG_NO_FORMATTING */ | |
935 | ||
340931cb A |
936 | #endif /* U_SHOW_CPLUSPLUS_API */ |
937 | ||
b75a7d8f | 938 | #endif // _SIMPLETZ |