net.time4j.tz.ZonalTransition.getDaylightSavingOffset()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(92)

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

ZonalTransition.getDaylightSavingOffset介绍

[英]Returns the DST-shift (daylight savings) after this transition that is the shift normally induced by change to summer time.
[中]返回此转换后的DST转换(夏令时),该转换通常由夏季时间的更改引起。

代码示例

代码示例来源:origin: net.time4j/time4j-core

return (this.total - this.getDaylightSavingOffset());

代码示例来源:origin: net.time4j/time4j-core

@Override
public ZonalOffset getDaylightSavingOffset(UnixTime ut) {
  ZonalTransition t = this.history.getStartTransition(ut);
  return (
    (t == null)
    ? ZonalOffset.UTC
    : ZonalOffset.ofTotalSeconds(t.getDaylightSavingOffset())
  );
}

代码示例来源:origin: net.time4j/time4j-olson

static void dump(
  ZonalTransition transition,
  Appendable buffer
) throws IOException {
  Moment ut = Moment.of(transition.getPosixTime(), TimeScale.POSIX);
  buffer.append(">>> Transition at: ").append(ut.toString());
  buffer.append(" from ").append(format(transition.getPreviousOffset()));
  buffer.append(" to ").append(format(transition.getTotalOffset()));
  buffer.append(", DST=");
  buffer.append(format(transition.getDaylightSavingOffset()));
  buffer.append(NEW_LINE);
}

代码示例来源:origin: net.time4j/time4j-core

@Override
public int getDSTSavings() {
  TransitionHistory history = this.tz.getHistory();
  if (history != null) {
    List<ZonalTransition> transitions = history.getStdTransitions();
    int dst = 0;
    for (int i = transitions.size() - 1; i >= 0; i--) {
      ZonalTransition t = transitions.get(i);
      if (t.isDaylightSaving()) {
        dst = t.getDaylightSavingOffset() * 1000;
        break;
      }
    }
    return dst;
  }
  return 0;
}

代码示例来源:origin: net.time4j/time4j-olson

private static void writeRuleBasedTransitionModel(
  Object obj,
  ObjectOutput out
) throws IOException {
  RuleBasedTransitionModel model = (RuleBasedTransitionModel) obj;
  ZonalTransition initial = model.getInitialTransition();
  long posixTime = initial.getPosixTime();
  if (
    (posixTime >= POSIX_TIME_1825)
    && (posixTime < POSIX_TIME_1825 + QUARTERS_IN_24_BITS)
    && ((posixTime % 900) == 0)
  ) {
    int data = (int) ((posixTime - POSIX_TIME_1825) / 900);
    out.writeByte((data >>> 16) & 0xFF);
    out.writeByte((data >>> 8) & 0xFF);
    out.writeByte(data & 0xFF);
  } else {
    out.writeByte(0xFF);
    out.writeLong(initial.getPosixTime());
  }
  writeOffset(out, initial.getPreviousOffset());
  writeOffset(out, initial.getTotalOffset());
  int dst = initial.getDaylightSavingOffset();
  if (initial.isDaylightSaving() && (dst == 0)) {
    dst = Integer.MAX_VALUE;
  }
  writeOffset(out, dst);
  writeRules(model.getRules(), out);
}

代码示例来源:origin: net.time4j/time4j-olson

int dstOffset = transition.getDaylightSavingOffset();

相关文章