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

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

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

ZonalTransition.isDaylightSaving介绍

[英]Queries if there is any positive daylight savings after this transition.
[中]询问在此过渡后是否有任何积极的夏令时。

代码示例

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

@Override
public boolean isDaylightSaving(UnixTime ut) {
  ZonalTransition t = this.history.getStartTransition(ut);
  return ((t != null) && t.isDaylightSaving());
}

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

@Override
public boolean useDaylightTime() {
  if (!this.tz.isFixed()) {
    TransitionHistory history = this.tz.getHistory();
    if (history != null) {
      List<ZonalTransition> transitions = history.getStdTransitions();
      for (int i = transitions.size() - 1; i >= 0; i--) {
        if (transitions.get(i).isDaylightSaving()) {
          return true;
        }
      }
    }
  }
  return false;
}

代码示例来源: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

if (initial.isDaylightSaving()) {
  throw new IllegalArgumentException(
    "Initial transition must not have any dst-offset: "

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

if (transition.isDaylightSaving() && (dstOffset == 0)) {
  dstOffset = Integer.MAX_VALUE;

相关文章