java.util.TimeZone.getDefaultRef()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中java.util.TimeZone.getDefaultRef()方法的一些代码示例,展示了TimeZone.getDefaultRef()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeZone.getDefaultRef()方法的具体详情如下:
包路径:java.util.TimeZone
类名称:TimeZone
方法名:getDefaultRef

TimeZone.getDefaultRef介绍

[英]Returns the reference to the default TimeZone object. This method doesn't create a clone.
[中]返回对默认时区对象的引用。此方法不会创建克隆。

代码示例

代码示例来源:origin: stackoverflow.com

createCalendar(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT))

代码示例来源:origin: stackoverflow.com

@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;
}

代码示例来源:origin: stackoverflow.com

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;
}

代码示例来源:origin: stackoverflow.com

public static Calendar getInstance()
{
  Calendar cal = createCalendar(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT));
  cal.sharedZone = true;
  return cal;
}

代码示例来源:origin: stackoverflow.com

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();

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * 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;
}

代码示例来源:origin: stackoverflow.com

protected Calendar()
{
  this(TimeZone.getDefaultRef(), Locale.getDefault());
  sharedZone = true;
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * 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;
}

代码示例来源:origin: stackoverflow.com

Calendar cal = createCalendar(TimeZone.getDefaultRef(), Locale.getDefault());

代码示例来源:origin: stackoverflow.com

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);
 }

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * 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();
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * 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();
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * 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;
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * 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;
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * 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;
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * 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;
}

代码示例来源:origin: stackoverflow.com

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)

代码示例来源:origin: org.apidesign.bck2brwsr/emul

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;
  }

代码示例来源:origin: jtulach/bck2brwsr

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;
  }

代码示例来源:origin: jtulach/bck2brwsr

cdate = (BaseCalendar.Datum) cal.newCalendarDate(TimeZone.getDefaultRef());
cdate.setNormalizedDate(y, month + 1, date).setTimeOfDay(hrs, min, sec, 0);
getTimeImpl();

相关文章