Home | History | Annotate | Download | only in util

Lines Matching defs:timeZone

25 import java.util.TimeZone;
41 private static final TimeZone UTC = TimeZone.getTimeZone("UTC");
44 * Sanity check to ensure that the standard TimeZone for Europe/Paris has the correct DST
48 TimeZone timeZone = TimeZone.getTimeZone("Europe/Paris");
50 checkDstParis2014(timeZone);
54 TimeZone timeZone = new SimpleTimeZone(PARIS_RAW_OFFSET, "Europe/Paris",
58 checkDstParis2014(timeZone);
62 TimeZone timeZone = new SimpleTimeZone(PARIS_RAW_OFFSET, "Europe/Paris",
66 checkDstParis2014(timeZone);
70 TimeZone timeZone = new SimpleTimeZone(PARIS_RAW_OFFSET, "Europe/Paris",
74 checkDstParis2014(timeZone);
78 * Check that the DST transitions in the supplied {@link TimeZone} are as expected for
81 private void checkDstParis2014(TimeZone timeZone) {
82 checkDstTransitionTimes(timeZone, 2014,
88 TimeZone timeZone = new SimpleTimeZone(-18000000, "EST",
93 checkDstTransitionTimes(timeZone, 1998,
97 checkDstTransitionTimes(timeZone, 2014,
103 * Sanity check to ensure that the standard TimeZone for America/New_York has the correct DST
107 TimeZone timeZone = TimeZone.getTimeZone("America/New_York");
109 checkDstNewYork2014(timeZone);
113 TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST",
118 checkDstNewYork2014(timeZone);
122 TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST",
127 checkDstNewYork2014(timeZone);
131 TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST",
136 checkDstNewYork2014(timeZone);
140 TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST",
145 checkDstNewYork2014(timeZone);
149 TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST",
154 checkDstNewYork2014(timeZone);
158 TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST",
163 checkDstNewYork2014(timeZone);
167 TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST",
172 checkDstNewYork2014(timeZone);
176 TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST",
181 checkDstNewYork2014(timeZone);
185 * Check that the DST transitions in the supplied {@link TimeZone} are as expected for
188 private void checkDstNewYork2014(TimeZone timeZone) {
189 checkDstTransitionTimes(timeZone, 2014,
197 * @param timeZone the {@link TimeZone} whose transition points are being found.
198 * @param startOfYearMillis the start of the calendar year in {@code timeZone} to scan, in
202 private static long[] findDstEntryAndExit(TimeZone timeZone, long startOfYearMillis) {
203 if (!timeZone.useDaylightTime()) {
204 throw new IllegalStateException("Time zone " + timeZone
210 GregorianCalendar cal = new GregorianCalendar(timeZone, Locale.ENGLISH);
213 while (!timeZone.inDaylightTime(new Date(cal.getTimeInMillis()))) {
217 "Doesn't enter daylight savings time in " + year + " in " + timeZone);
223 assertFalse(timeZone.inDaylightTime(cal.getTime()));
227 while (timeZone.inDaylightTime(new Date(cal.getTimeInMillis()))) {
230 "Doesn't exit daylight savings time in " + year + " in " + timeZone);
236 assertTrue(timeZone.inDaylightTime(cal.getTime()));
252 private static String formatTime(TimeZone timeZone, long millis) {
253 Calendar cal = new GregorianCalendar(timeZone, Locale.ENGLISH);
258 private void checkDstTransitionTimes(TimeZone timeZone, int year,
262 GregorianCalendar calendar = new GregorianCalendar(timeZone, Locale.ENGLISH);
268 long[] simpleTransitions = findDstEntryAndExit(timeZone, start);