01: /*
02: * Copyright 2001-2006 Stephen Colebourne
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.joda.time;
17:
18: import java.util.Iterator;
19: import java.util.Set;
20:
21: import junit.framework.TestCase;
22:
23: /**
24: * Test.
25: */
26: public class TempTest extends TestCase {
27:
28: public static void main(String[] args) {
29: DateTime start = new DateTime(1800, 1, 1, 0, 0, 0, 0,
30: DateTimeZone.UTC);
31: DateTime end = new DateTime(2020, 1, 1, 0, 0, 0, 0,
32: DateTimeZone.UTC);
33: long startMillis = start.getMillis();
34: long endMillis = end.getMillis();
35:
36: Set set = DateTimeZone.getAvailableIDs();
37: for (Iterator it = set.iterator(); it.hasNext();) {
38: String zoneID = (String) it.next();
39: DateTimeZone zone = DateTimeZone.forID(zoneID);
40: System.out.println(zone.getID());
41:
42: long millis = startMillis;
43: long last = Long.MIN_VALUE / 2;
44: while (millis < endMillis) {
45: millis = zone.nextTransition(millis);
46: if (millis == last) {
47: break;
48: }
49: if (millis - last <= DateTimeConstants.MILLIS_PER_HOUR) {
50: System.out.println(new DateTime(millis, zone) + " "
51: + zone.getID());
52: }
53: last = millis;
54: }
55: }
56:
57: DateTimeZone zone = DateTimeZone.forID("Antarctica/Rothera");
58: long millis = startMillis;
59: long last = Long.MIN_VALUE;
60: while (millis < endMillis) {
61: millis = zone.nextTransition(millis);
62: if (millis == last) {
63: break;
64: }
65: System.out.println(new DateTime(millis - 1, zone) + " "
66: + zone.getID());
67: System.out.println(new DateTime(millis, zone) + " "
68: + zone.getID());
69: last = millis;
70: }
71: }
72:
73: }
|