Lines Matching refs:timeZone
65 import java.util.TimeZone;
128 // TimeZone cache; we parse/decode as little as possible, because the process is quite slow
129 private static HashMap<String, TimeZone> sTimeZoneCache = new HashMap<String, TimeZone>();
131 private static HashMap<TimeZone, String> sTziStringCache = new HashMap<TimeZone, String>();
133 private static final TimeZone UTC_TIMEZONE = TimeZone.getTimeZone("UTC");
164 static final TimeZone sGmtTimeZone = TimeZone.getTimeZone("GMT");
259 // Turn hours/minutes into ms from midnight (per TimeZone)
266 GregorianCalendar cal = new GregorianCalendar(TimeZone.getDefault());
270 // MSFT months are 1 based; TimeZone is 0 based
272 // MSFT day of week starts w/ Sunday = 0; TimeZone starts w/ Sunday = 1
275 // Get the "day" in TimeZone format
277 // 5 means "last" in MSFT land; for TimeZone, it's -1
280 // Turn hours/minutes into ms from midnight (per TimeZone)
289 // MSFT year is an int; TimeZone is a String
294 // MSFT months are 1 based; TimeZone is 0 based
302 // MSFT day of week starts w/ Sunday = 0; TimeZone starts w/ Sunday = 1
305 // Get the "day" in TimeZone format
307 // 5 means "last" in MSFT land; for TimeZone, it's -1
314 // Turn hours/minutes into ms from midnight (per TimeZone)
326 * @param timeZone the time zone we're checking
330 static long getMillisAtTimeZoneDateTransition(TimeZone timeZone, TimeZoneDate tzd) {
331 GregorianCalendar testCalendar = new GregorianCalendar(timeZone);
345 * @param tz a TimeZone the time zone in which we're looking for transitions
351 static GregorianCalendar findTransitionDate(TimeZone tz, long startTime,
380 * Return a Base64 representation of a MSFT TIME_ZONE_INFORMATION structure from a TimeZone
382 * @param tz the TimeZone
385 static public String timeZoneToTziString(TimeZone tz) {
550 static boolean getDSTCalendars(TimeZone tz, GregorianCalendar[] toDaylightCalendars,
595 static private void writeNoDST(SimpleIcsWriter writer, TimeZone tz, String offsetString)
606 /** Write a VTIMEZONE block for a given TimeZone into a SimpleIcsWriter
607 * @param tz the TimeZone to be used in the conversion
611 static void timeZoneToVTimezone(TimeZone tz, SimpleIcsWriter writer)
696 * Calculate the Base64 representation of a MSFT TIME_ZONE_INFORMATION structure from a TimeZone
697 * that might be found in an Event. Since the internal representation of the TimeZone is hidden
699 * @param tz the TimeZone
702 static String timeZoneToTziStringImpl(TimeZone tz) {
754 * Given a String as directly read from EAS, returns a TimeZone corresponding to that String
756 * @param precision the number of milliseconds of precision in TimeZone determination
757 * @return the TimeZone, or TimeZone.getDefault() if not found
760 static TimeZone tziStringToTimeZone(String timeZoneString, int precision) {
762 TimeZone timeZone = sTimeZoneCache.get(timeZoneString);
763 if (timeZone != null) {
765 ExchangeService.log(TAG, " Using cached TimeZone " + timeZone.getID());
768 timeZone = tziStringToTimeZoneImpl(timeZoneString, precision);
769 if (timeZone == null) {
770 // If we don't find a match, we just return the current TimeZone. In theory, this
772 ExchangeService.alwaysLog("TimeZone not found using default: " + timeZoneString);
773 timeZone = TimeZone.getDefault();
775 sTimeZoneCache.put(timeZoneString, timeZone);
777 return timeZone;
783 static public TimeZone tziStringToTimeZone(String timeZoneString) {
788 * Given a String as directly read from EAS, tries to find a TimeZone in the database of all
793 * @return the TimeZone, or null if not found
795 static TimeZone tziStringToTimeZoneImpl(String timeZoneString, int precision) {
796 TimeZone timeZone = null;
800 // Then, we get the bias (similar to a rawOffset); for TimeZone, we need ms
808 String[] zoneIds = TimeZone.getAvailableIDs(bias);
810 // Try to find an existing TimeZone from the data provided by EAS
816 TimeZone defaultTimeZone = TimeZone.getDefault();
820 ExchangeService.log(TAG, "TimeZone without DST found to be default: " +
829 timeZone = TimeZone.getTimeZone(zoneId);
830 if (!timeZone.useDaylightTime()) {
832 ExchangeService.log(TAG, "TimeZone without DST found by offset: " +
833 timeZone.getID());
835 return timeZone;
850 // Get the TimeZone using the zoneId
851 timeZone = TimeZone.getTimeZone(zoneId);
860 long millisAtTransition = getMillisAtTimeZoneDateTransition(timeZone, dstStart);
863 if (timeZone.inDaylightTime(before)) continue;
864 if (!timeZone.inDaylightTime(after)) continue;
867 millisAtTransition = getMillisAtTimeZoneDateTransition(timeZone, dstEnd);
872 if (!timeZone.inDaylightTime(before)) continue;
873 if (timeZone.inDaylightTime(after)) continue;
876 if (dstSavings != timeZone.getDSTSavings()) continue;
877 return timeZone;
882 timeZone = tziStringToTimeZoneImpl(timeZoneString, LENIENT_DST_PRECISION);
891 TimeZone tz = TimeZone.getTimeZone(tzName);
893 timeZone = tz;
896 timeZone = TimeZone.getTimeZone(zoneIds[0]);
899 timeZone = TimeZone.getTimeZone(zoneIds[0]);
904 "No TimeZone with correct DST settings; using " +
906 timeZone.getID());
908 return timeZone;
959 static public String millisToEasDateTime(long millis, TimeZone tz, boolean withTime) {
1019 static String transitionMillisToVCalendarTime(long millis, TimeZone tz, boolean dst) {
1038 static public long getUtcAllDayCalendarTime(long time, TimeZone localTimeZone) {
1047 static public long getLocalAllDayCalendarTime(long time, TimeZone localTimeZone) {
1051 static private long transposeAllDayTime(long time, TimeZone fromTimeZone,
1052 TimeZone toTimeZone) {
1145 GregorianCalendar localCalendar = new GregorianCalendar(TimeZone.getDefault());
1289 cal.setTimeZone(TimeZone.getDefault());
1609 Date date = new Date(getLocalAllDayCalendarTime(startTime, TimeZone.getDefault()));
1725 TimeZone vCalendarTimeZone = sGmtTimeZone;
1746 vCalendarTimeZone = TimeZone.getDefault();