/** * Writes the state to the stream. * * @param out the output stream, not null * @throws IOException if an error occurs */ void writeExternal(DataOutput out) throws IOException { Ser.writeEpochSec(toEpochSecond(), out); Ser.writeOffset(offsetBefore, out); Ser.writeOffset(offsetAfter, out); }
/** * Writes the state to the stream. * * @param out the output stream, not null * @throws IOException if an error occurs */ void writeExternal(DataOutput out) throws IOException { Ser.writeEpochSec(toEpochSecond(), out); Ser.writeOffset(offsetBefore, out); Ser.writeOffset(offsetAfter, out); }
this.standardOffsets[0] = baseStandardOffset; for (int i = 0; i < standardOffsetTransitionList.size(); i++) { this.standardTransitions[i] = standardOffsetTransitionList.get(i).toEpochSecond(); this.standardOffsets[i + 1] = standardOffsetTransitionList.get(i).getOffsetAfter();
this.standardOffsets[0] = baseStandardOffset; for (int i = 0; i < standardOffsetTransitionList.size(); i++) { this.standardTransitions[i] = standardOffsetTransitionList.get(i).toEpochSecond(); this.standardOffsets[i + 1] = standardOffsetTransitionList.get(i).getOffsetAfter();
@Override public ZoneOffset getOffset(Instant instant) { long epochSec = instant.getEpochSecond(); // check if using last rules if (lastRules.length > 0 && epochSec > savingsInstantTransitions[savingsInstantTransitions.length - 1]) { int year = findYear(epochSec, wallOffsets[wallOffsets.length - 1]); ZoneOffsetTransition[] transArray = findTransitionArray(year); ZoneOffsetTransition trans = null; for (int i = 0; i < transArray.length; i++) { trans = transArray[i]; if (epochSec < trans.toEpochSecond()) { return trans.getOffsetBefore(); } } return trans.getOffsetAfter(); } // using historic rules int index = Arrays.binarySearch(savingsInstantTransitions, epochSec); if (index < 0) { // switch negative insert position to start of matched range index = -index - 2; } return wallOffsets[index + 1]; }
@Override public ZoneOffset getOffset(Instant instant) { long epochSec = instant.getEpochSecond(); // check if using last rules if (lastRules.length > 0 && epochSec > savingsInstantTransitions[savingsInstantTransitions.length - 1]) { int year = findYear(epochSec, wallOffsets[wallOffsets.length - 1]); ZoneOffsetTransition[] transArray = findTransitionArray(year); ZoneOffsetTransition trans = null; for (int i = 0; i < transArray.length; i++) { trans = transArray[i]; if (epochSec < trans.toEpochSecond()) { return trans.getOffsetBefore(); } } return trans.getOffsetAfter(); } // using historic rules int index = Arrays.binarySearch(savingsInstantTransitions, epochSec); if (index < 0) { // switch negative insert position to start of matched range index = -index - 2; } return wallOffsets[index + 1]; }
ZoneOffsetTransition[] transArray = findTransitionArray(year); for (ZoneOffsetTransition trans : transArray) { if (epochSec < trans.toEpochSecond()) { return trans;
ZoneOffsetTransition[] transArray = findTransitionArray(year); for (ZoneOffsetTransition trans : transArray) { if (epochSec < trans.toEpochSecond()) { return trans;
ZoneOffsetTransition[] transArray = findTransitionArray(year); for (int i = transArray.length - 1; i >= 0; i--) { if (epochSec > transArray[i].toEpochSecond()) { return transArray[i];
ZoneOffsetTransition[] transArray = findTransitionArray(year); for (int i = transArray.length - 1; i >= 0; i--) { if (epochSec > transArray[i].toEpochSecond()) { return transArray[i];
for (TZRule rule : window.ruleList) { ZoneOffsetTransition trans = rule.toTransition(loopStandardOffset, loopSavings); if (trans.toEpochSecond() > loopWindowStart.toEpochSecond(loopWindowOffset)) { if (trans.toEpochSecond() < loopWindowStart.toEpochSecond(loopWindowOffset) == false && trans.toEpochSecond() < window.createDateTimeEpochSecond(loopSavings) && trans.getOffsetBefore().equals(trans.getOffsetAfter()) == false) { transitionList.add(trans);
for (TZRule rule : window.ruleList) { ZoneOffsetTransition trans = rule.toTransition(loopStandardOffset, loopSavings); if (trans.toEpochSecond() > loopWindowStart.toEpochSecond(loopWindowOffset)) { if (trans.toEpochSecond() < loopWindowStart.toEpochSecond(loopWindowOffset) == false && trans.toEpochSecond() < window.createDateTimeEpochSecond(loopSavings) && trans.getOffsetBefore().equals(trans.getOffsetAfter()) == false) { transitionList.add(trans);