/** * <p>Creates a finite half-open interval between midnight at start of day * and given end time. </p> * * @param end time of upper boundary (exclusive) * @return new time interval * @since 2.0 */ /*[deutsch] * <p>Erzeugt ein begrenztes halb-offenes Intervall zwischen Mitternacht * zu Beginn des Tages und der angegebenen Endzeit. </p> * * @param end time of upper boundary (exclusive) * @return new time interval * @since 2.0 */ public static ClockInterval until(PlainTime end) { return between(PlainTime.midnightAtStartOfDay(), end); }
map.put(PlainTime.midnightAtStartOfDay(), timeToLabels.get(key)); map.remove(key); } else if (timeToLabels.get(key).isEmpty()) {
/** * <p>Determines the end of the day period which covers given clock time. </p> * * @param context the clock time a day period is searched for * @return end of day period around given clock time, exclusive * @see #getStart(PlainTime) * @since 3.13/4.10 */ /*[deutsch] * <p>Ermittelt das Ende des Tagesabschnitts, der die angegebene Uhrzeit enthält. </p> * * @param context the clock time a day period is searched for * @return end of day period around given clock time, exclusive * @see #getStart(PlainTime) * @since 3.13/4.10 */ public PlainTime getEnd(PlainTime context) { PlainTime compare = ( (context.getHour() == 24) ? PlainTime.midnightAtStartOfDay() : context); for (PlainTime key : this.codeMap.keySet()) { if (compare.isBefore(key)) { return key; } } return this.codeMap.firstKey(); }
int hour = Integer.parseInt(key.substring(1, 3)); int minute = Integer.parseInt(key.substring(3, 5)); PlainTime time = PlainTime.midnightAtStartOfDay(); if (hour == 24) { if (minute != 0) {
? PlainTime.midnightAtStartOfDay() : context); PlainTime last = this.codeMap.lastKey();
private static DaylightSavingRule readLastDayOfWeekPattern(DataInput in) throws IOException, ClassNotFoundException { int first = (in.readByte() & 0xFF); Month month = Month.valueOf(first >>> 4); int offsetInfo = first & 0x0F; OffsetIndicator indicator = OffsetIndicator.VALUES[offsetInfo % 3]; int dst = readSavings(offsetInfo); int second = (in.readByte() & 0xFF); Weekday dayOfWeek = Weekday.valueOf(second >>> 5); int tod = (second & 31); if (dst == -1) { dst = readOffset(in); } if (tod == 31) { tod = in.readInt(); } else { tod *= 3600; } PlainTime timeOfDay = PlainTime.midnightAtStartOfDay().with(SECOND_OF_DAY, tod); return new LastWeekdayPattern( month, dayOfWeek, timeOfDay, indicator, dst); }
PlainTime.midnightAtStartOfDay().with(SECOND_OF_DAY, tod);
private static DaylightSavingRule readFixedDayPattern(DataInput in) throws IOException, ClassNotFoundException { int first = (in.readByte() & 0xFF); int month = (first >>> 4); int offsetInfo = first & 0x0F; OffsetIndicator indicator = OffsetIndicator.VALUES[offsetInfo % 3]; int dst = readSavings(offsetInfo); int second = (in.readByte() & 0xFF); int dayOfMonth = (second >>> 3); int tod = toTimeOfDayR(second & 7); if (dst == -1) { dst = readOffset(in); } if (tod == -1) { tod = in.readInt(); } PlainTime timeOfDay = PlainTime.midnightAtStartOfDay().with(SECOND_OF_DAY, tod); return new FixedDayPattern( Month.valueOf(month), dayOfMonth, timeOfDay, indicator, dst); }
@Override public PlainTime translate(java.sql.Time source) { long millis = source.getTime(); // UTC zone if (!WITH_SQL_UTC_CONVERSION) { Moment unixTime = Moment.of( MathUtils.floorDivide(millis, 1000), TimeScale.POSIX); ZonalOffset offset = Timezone.ofSystem().getOffset(unixTime); millis += offset.getIntegralAmount() * 1000; } return PlainTime.midnightAtStartOfDay().with( PlainTime.MILLI_OF_DAY, MathUtils.floorModulo(millis, 86400 * 1000) ); }
private GeneralTimestamp( CalendarVariant<?> cv, Calendrical<?, ?> ca, PlainTime time ) { super(); if (time.getHour() == 24) { // NPE-check if (cv == null) { this.cv = null; this.ca = ca.plus(CalendarDays.of(1)); } else { this.cv = cv.plus(CalendarDays.of(1)); this.ca = null; } this.time = PlainTime.midnightAtStartOfDay(); } else { this.cv = cv; this.ca = ca; this.time = time; } }
private FullValueOperator(int type) { super(PlainTime.COMPONENT, type); this.tsop = entity -> { PlainTime time = doApply(entity.getWallTime()); if (time.getHour() == 24) { return PlainTimestamp.of( entity.getCalendarDate().plus(1, DAYS), PlainTime.midnightAtStartOfDay()); } else { return entity.with(time); } }; }
if (end.isAfter(time) || end.isSimultaneous(PlainTime.midnightAtStartOfDay())) { m = Meridiem.PM; } else if (hour12 != -1) {
/** * <p>Yields the length of this interval. </p> * * @return duration in hours, minutes, seconds and nanoseconds * @since 2.0 */ /*[deutsch] * <p>Liefert die Länge dieses Intervalls. </p> * * @return duration in hours, minutes, seconds and nanoseconds * @since 2.0 */ public Duration<ClockUnit> getDuration() { PlainTime t1 = this.getTemporalOfClosedStart(); PlainTime t2 = this.getEnd().getTemporal(); if (this.getEnd().isClosed()) { if (t2.getHour() == 24) { if (t1.equals(PlainTime.midnightAtStartOfDay())) { return Duration.of(24, HOURS).plus(1, NANOS); } else { t1 = t1.minus(1, NANOS); } } else { t2 = t2.plus(1, NANOS); } } return Duration.inClockUnits().between(t1, t2); }