TZRule rule = new TZRule(year, month, dayOfMonthIndicator, dayOfWeek, time, adjustDays, timeDefinition, savingAmountSecs); if (lastRule) { lastRuleList.add(rule);
ZoneOffsetTransition trans = rule.toTransition(loopStandardOffset, loopSavings); if (trans.toEpochSecond() > loopWindowStart.toEpochSecond(loopWindowOffset)) { ZoneOffsetTransition trans = deduplicate(rule.toTransition(loopStandardOffset, loopSavings)); if (trans.toEpochSecond() < loopWindowStart.toEpochSecond(loopWindowOffset) == false && trans.toEpochSecond() < window.createDateTimeEpochSecond(loopSavings) && ZoneOffsetTransitionRule transitionRule = deduplicate(lastRule.toTransitionRule(loopStandardOffset, loopSavings)); lastTransitionRuleList.add(transitionRule); loopSavings = lastRule.savingAmountSecs;
ZoneOffsetTransition trans = rule.toTransition(loopStandardOffset, loopSavings); if (trans.toEpochSecond() > loopWindowStart.toEpochSecond(loopWindowOffset)) { ZoneOffsetTransition trans = deduplicate(rule.toTransition(loopStandardOffset, loopSavings)); if (trans.toEpochSecond() < loopWindowStart.toEpochSecond(loopWindowOffset) == false && trans.toEpochSecond() < window.createDateTimeEpochSecond(loopSavings) && ZoneOffsetTransitionRule transitionRule = deduplicate(lastRule.toTransitionRule(loopStandardOffset, loopSavings)); lastTransitionRuleList.add(transitionRule); loopSavings = lastRule.savingAmountSecs;
TZRule rule = new TZRule(year, month, dayOfMonthIndicator, dayOfWeek, time, adjustDays, timeDefinition, savingAmountSecs); if (lastRule) { lastRuleList.add(rule);
/** * Converts this to a transition rule. * * @param standardOffset the active standard offset, not null * @param savingsBeforeSecs the active savings before the transition in seconds * @return the transition, not null */ ZoneOffsetTransitionRule toTransitionRule(ZoneOffset standardOffset, int savingsBeforeSecs) { // optimize stored format if (dayOfMonthIndicator < 0) { if (month != Month.FEBRUARY) { dayOfMonthIndicator = month.maxLength() - 6; } } // build rule ZoneOffsetTransition trans = toTransition(standardOffset, savingsBeforeSecs); return new ZoneOffsetTransitionRule( month, dayOfMonthIndicator, dayOfWeek, time, adjustDays, timeDefinition, standardOffset, trans.getOffsetBefore(), trans.getOffsetAfter()); }
/** * Converts this to a transition rule. * * @param standardOffset the active standard offset, not null * @param savingsBeforeSecs the active savings before the transition in seconds * @return the transition, not null */ ZoneOffsetTransitionRule toTransitionRule(ZoneOffset standardOffset, int savingsBeforeSecs) { // optimize stored format if (dayOfMonthIndicator < 0) { if (month != Month.FEBRUARY) { dayOfMonthIndicator = month.maxLength() - 6; } } // build rule ZoneOffsetTransition trans = toTransition(standardOffset, savingsBeforeSecs); return new ZoneOffsetTransitionRule( month, dayOfMonthIndicator, dayOfWeek, time, adjustDays, timeDefinition, standardOffset, trans.getOffsetBefore(), trans.getOffsetAfter()); }
/** * Converts this to a transition. * * @param standardOffset the active standard offset, not null * @param savingsBeforeSecs the active savings in seconds * @return the transition, not null */ ZoneOffsetTransition toTransition(ZoneOffset standardOffset, int savingsBeforeSecs) { // copy of code in ZoneOffsetTransitionRule to avoid infinite loop LocalDate date = toLocalDate(); date = deduplicate(date); LocalDateTime ldt = deduplicate(LocalDateTime.of(date.plusDays(adjustDays), time)); ZoneOffset wallOffset = deduplicate(ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingsBeforeSecs)); LocalDateTime dt = deduplicate(timeDefinition.createDateTime(ldt, standardOffset, wallOffset)); ZoneOffset offsetAfter = deduplicate(ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingAmountSecs)); return new ZoneOffsetTransition(dt, wallOffset, offsetAfter); }
public int compareTo(TZRule other) { int cmp = year - other.year; cmp = (cmp == 0 ? month.compareTo(other.month) : cmp); if (cmp == 0) { // convert to date to handle dow/domIndicator/timeEndOfDay LocalDate thisDate = toLocalDate(); LocalDate otherDate = other.toLocalDate(); cmp = thisDate.compareTo(otherDate); } if (cmp != 0) { return cmp; } long timeSecs1 = time.toSecondOfDay() + adjustDays * 86400; long timeSecs2 = other.time.toSecondOfDay() + other.adjustDays * 86400; return timeSecs1 < timeSecs2 ? -1 : (timeSecs1 > timeSecs2 ? 1 : 0); }
/** * Converts this to a transition. * * @param standardOffset the active standard offset, not null * @param savingsBeforeSecs the active savings in seconds * @return the transition, not null */ ZoneOffsetTransition toTransition(ZoneOffset standardOffset, int savingsBeforeSecs) { // copy of code in ZoneOffsetTransitionRule to avoid infinite loop LocalDate date = toLocalDate(); date = deduplicate(date); LocalDateTime ldt = deduplicate(LocalDateTime.of(date.plusDays(adjustDays), time)); ZoneOffset wallOffset = deduplicate(ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingsBeforeSecs)); LocalDateTime dt = deduplicate(timeDefinition.createDateTime(ldt, standardOffset, wallOffset)); ZoneOffset offsetAfter = deduplicate(ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingAmountSecs)); return new ZoneOffsetTransition(dt, wallOffset, offsetAfter); }
public int compareTo(TZRule other) { int cmp = year - other.year; cmp = (cmp == 0 ? month.compareTo(other.month) : cmp); if (cmp == 0) { // convert to date to handle dow/domIndicator/timeEndOfDay LocalDate thisDate = toLocalDate(); LocalDate otherDate = other.toLocalDate(); cmp = thisDate.compareTo(otherDate); } if (cmp != 0) { return cmp; } long timeSecs1 = time.toSecondOfDay() + adjustDays * 86400; long timeSecs2 = other.time.toSecondOfDay() + other.adjustDays * 86400; return timeSecs1 < timeSecs2 ? -1 : (timeSecs1 > timeSecs2 ? 1 : 0); }