@Override public boolean isLeapSecond() { return this.moment.isLeapSecond(); }
@Override public int getInt(ChronoElement<Integer> element) { if (this.moment.isLeapSecond() && (element == SECOND_OF_MINUTE)) { return 60; } int value = this.timestamp.getInt(element); if (value == Integer.MIN_VALUE) { value = this.moment.getInt(element); } return value; }
@Override public <V> V get(ChronoElement<V> element) { if ( this.moment.isLeapSecond() && (element == SECOND_OF_MINUTE) ) { return element.getType().cast(Integer.valueOf(60)); } if (this.timestamp.contains(element)) { return this.timestamp.get(element); } else { return this.moment.get(element); } }
@Override public V apply(Moment context) { ZonalOffset shift = ( (this.offset == null) ? this.tz.getOffset(context) : this.offset); if ( (this.element == PlainTime.SECOND_OF_MINUTE) && context.isLeapSecond() && (shift.getFractionalAmount() == 0) && ((shift.getAbsoluteSeconds() % 60) == 0) ) { return this.element.getType().cast(Integer.valueOf(60)); } return PlainTimestamp.from(context, shift).get(this.element); }
private ZonalDateTime( Moment moment, Timezone tz ) { super(); this.zone = tz; ZonalOffset offset = tz.getOffset(moment); if (moment.isLeapSecond()) { if ( (offset.getFractionalAmount() != 0) || ((offset.getAbsoluteSeconds() % 60) != 0) ) { throw new IllegalArgumentException( "Leap second can only be represented " + " with timezone-offset in full minutes: " + offset); } } this.moment = moment; this.timestamp = PlainTimestamp.from(moment, offset); }
@Override public <V> V getMaximum(ChronoElement<V> element) { V max; if (this.timestamp.contains(element)) { max = this.timestamp.getMaximum(element); } else { max = this.moment.getMaximum(element); } if ( (element == SECOND_OF_MINUTE) && (this.timestamp.getYear() >= 1972) ) { PlainTimestamp ts = this.timestamp.with(element, max); if (!this.zone.isInvalid(ts, ts)) { Moment transformed = ts.in(this.zone); Moment test = transformed.plus(1, SI.SECONDS); if (test.isLeapSecond()) { return element.getType().cast(Integer.valueOf(60)); } } } return max; }
moment.isLeapSecond() && isNonIsoOffset(timezone, moment) ) { && (this.extractValue() == 60) ) { if (moment.isLeapSecond()) { return moment; } else if (isNonIsoOffset(timezone, moment)) { ) { if ( moment.isLeapSecond() || (this.type == ElementOperator.OP_CEILING) ) { case ElementOperator.OP_MAXIMIZE: case ElementOperator.OP_CEILING: if (moment.isLeapSecond()) { result = result.plus(1, SI.SECONDS);
} else if (this.isLeapSecond()) { throw new IllegalArgumentException("Leap seconds do not exist on continuous time scale: " + scale);
if (context.isLeapSecond() && LeapSeconds.getInstance().isEnabled()) { return result.plus(1, SI.SECONDS); } else {
if (!moment.isLeapSecond()) { throw new IllegalArgumentException("Parsed leap second is invalid.");
if (this.isLeapSecond()) { return new Moment( this.getNanosecond(),
if (end.isLeapSecond()) { for (ElementPosition position : positions) { if (position.getElement() == PlainTime.SECOND_OF_MINUTE) {