createCalendar(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT))
@Deprecated public Date(int year, int month, int date, int hrs, int min, int sec) { int y = year + 1900; // month is 0-based. So we have to normalize month to support Long.MAX_VALUE. if (month >= 12) { y += month / 12; month %= 12; } else if (month < 0) { y += CalendarUtils.floorDivide(month, 12); month = CalendarUtils.mod(month, 12); } BaseCalendar cal = getCalendarSystem(y); cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.getDefaultRef()); cdate.setNormalizedDate(y, month + 1, date).setTimeOfDay(hrs, min, sec, 0); getTimeImpl(); cdate = null; }
public Date(int year, int month, int date, int hrs, int min, int sec) { int y = year + 1900; // month is 0-based. So we have to normalize month to support Long.MAX_VALUE. if (month >= 12) { y += month / 12; month %= 12; } else if (month < 0) { y += CalendarUtils.floorDivide(month, 12); month = CalendarUtils.mod(month, 12); } BaseCalendar cal = getCalendarSystem(y); cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.getDefaultRef()); cdate.setNormalizedDate(y, month + 1, date).setTimeOfDay(hrs, min, sec, 0); getTimeImpl(); cdate = null; }
public static Calendar getInstance() { Calendar cal = createCalendar(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT)); cal.sharedZone = true; return cal; }
private static final BaseCalendar getCalendarSystem(long utc) { // Quickly check if the time stamp given by `utc' is the Epoch // or later. If it's before 1970, we convert the cutover to // local time to compare. if (utc >= 0 || utc >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER - TimeZone.getDefaultRef().getOffset(utc)) { return gcal; } return getJulianCalendar();
/** * Constructs a Calendar with the default time zone * and locale. * @see TimeZone#getDefault */ protected Calendar() { this(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT)); sharedZone = true; }
protected Calendar() { this(TimeZone.getDefaultRef(), Locale.getDefault()); sharedZone = true; }
/** * Constructs a Calendar with the default time zone * and locale. * @see TimeZone#getDefault */ protected Calendar() { this(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT)); sharedZone = true; }
Calendar cal = createCalendar(TimeZone.getDefaultRef(), Locale.getDefault());
private final BaseCalendar.Date normalize() { if (cdate == null) { BaseCalendar cal = getCalendarSystem(fastTime); cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime, TimeZone.getDefaultRef()); return cdate; } // Normalize cdate with the TimeZone in cdate first. This is // required for the compatible behavior. if (!cdate.isNormalized()) { cdate = normalize(cdate); } // If the default TimeZone has changed, then recalculate the // fields with the new TimeZone. TimeZone tz = TimeZone.getDefaultRef(); if (tz != cdate.getZone()) { cdate.setZone(tz); CalendarSystem cal = getCalendarSystem(cdate); cal.getCalendarDate(fastTime, cdate); }
/** * Gets the default <code>TimeZone</code> for this host. * The source of the default <code>TimeZone</code> * may vary with implementation. * @return a default <code>TimeZone</code>. * @see #setDefault */ public static TimeZone getDefault() { return (TimeZone) getDefaultRef().clone(); }
/** * Gets the default <code>TimeZone</code> for this host. * The source of the default <code>TimeZone</code> * may vary with implementation. * @return a default <code>TimeZone</code>. * @see #setDefault */ public static TimeZone getDefault() { return (TimeZone) getDefaultRef().clone(); }
/** * Gets a calendar using the default time zone and locale. The * <code>Calendar</code> returned is based on the current time * in the default time zone with the default locale. * * @return a Calendar. */ public static Calendar getInstance() { Calendar cal = createCalendar(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT)); cal.sharedZone = true; return cal; }
/** * Gets a calendar using the default time zone and specified locale. * The <code>Calendar</code> returned is based on the current time * in the default time zone with the given locale. * * @param aLocale the locale for the week data * @return a Calendar. */ public static Calendar getInstance(Locale aLocale) { Calendar cal = createCalendar(TimeZone.getDefaultRef(), aLocale); cal.sharedZone = true; return cal; }
/** * Gets a calendar using the default time zone and locale. The * <code>Calendar</code> returned is based on the current time * in the default time zone with the default locale. * * @return a Calendar. */ public static Calendar getInstance() { Calendar cal = createCalendar(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT)); cal.sharedZone = true; return cal; }
/** * Gets a calendar using the default time zone and specified locale. * The <code>Calendar</code> returned is based on the current time * in the default time zone with the given locale. * * @param aLocale the locale for the week data * @return a Calendar. */ public static Calendar getInstance(Locale aLocale) { Calendar cal = createCalendar(TimeZone.getDefaultRef(), aLocale); cal.sharedZone = true; return cal; }
java.lang.Thread.State: BLOCKED (on object monitor) at sun.awt.AppContext.get(AppContext.java:572) - waiting to lock <0x0000000705490070> (a java.util.HashMap) at sun.awt.AppContext$6.get(AppContext.java:774) at java.util.TimeZone.getDefaultInAppContext(TimeZone.java:637) at java.util.TimeZone.getDefaultRef(TimeZone.java:523) at java.util.Date.normalize(Date.java:1176) at java.util.Date.toString(Date.java:1010)
private final BaseCalendar.Datum normalize() { if (cdate == null) { // BaseCalendar cal = getCalendarSystem(fastTime); // cdate = (BaseCalendar.Datum) cal.getCalendarDate(fastTime, // TimeZone.getDefaultRef()); // return cdate; } // Normalize cdate with the TimeZone in cdate first. This is // required for the compatible behavior. if (!cdate.isNormalized()) { cdate = normalize(cdate); } // If the default TimeZone has changed, then recalculate the // fields with the new TimeZone. TimeZone tz = TimeZone.getDefaultRef(); if (tz != cdate.getZone()) { // cdate.setZone(tz); // CalendarSystem cal = getCalendarSystem(cdate); // cal.getCalendarDate(fastTime, cdate); } return cdate; }
private final BaseCalendar.Datum normalize() { if (cdate == null) { // BaseCalendar cal = getCalendarSystem(fastTime); // cdate = (BaseCalendar.Datum) cal.getCalendarDate(fastTime, // TimeZone.getDefaultRef()); // return cdate; } // Normalize cdate with the TimeZone in cdate first. This is // required for the compatible behavior. if (!cdate.isNormalized()) { cdate = normalize(cdate); } // If the default TimeZone has changed, then recalculate the // fields with the new TimeZone. TimeZone tz = TimeZone.getDefaultRef(); if (tz != cdate.getZone()) { // cdate.setZone(tz); // CalendarSystem cal = getCalendarSystem(cdate); // cal.getCalendarDate(fastTime, cdate); } return cdate; }
cdate = (BaseCalendar.Datum) cal.newCalendarDate(TimeZone.getDefaultRef()); cdate.setNormalizedDate(y, month + 1, date).setTimeOfDay(hrs, min, sec, 0); getTimeImpl();