/** * <p>Obtains the current clock time in system time. </p> * * <p>Convenient short-cut for: {@code SystemClock.inLocalView().now().toTime()}. </p> * * @return current wall time (without zone) in system time zone using the system clock * @see SystemClock#inLocalView() * @see ZonalClock#now() * @since 3.23/4.19 */ /*[deutsch] * <p>Ermittelt die aktuelle Uhrzeit in der Systemzeit. </p> * * <p>Bequeme Abkürzung für: {@code SystemClock.inLocalView().now().toTime()}. </p> * * @return current wall time (without zone) in system time zone using the system clock * @see SystemClock#inLocalView() * @see ZonalClock#now() * @since 3.23/4.19 */ public static PlainTime nowInSystemTime() { return ZonalClock.ofSystem().now().toTime(); }
@Override public PlainTimestamp addTo(PlainTimestamp tsp, long amount) { PlainDate date = dateRule.addTo(tsp.toDate(), amount); return PlainTimestamp.of(date, tsp.toTime()); } @Override
/** * <p>Does this rule match given timestamp such that any rule interval contains it? </p> * * <p>Example: If this rule describes shop opening times then this method yields the answer to the * question if the shop is open at given timestamp. </p> * * @param timestamp the timestamp to be checked * @return {@code true} if given timestamp fits to this rule else {@code false} * @since 4.20 */ /*[deutsch] * <p>Prüft, ob irgendein Zeitintervall dieser Regel den angegebenen Zeitstempel enthält. </p> * * <p>Beispiel: Wenn diese Regel Ladenöffnungszeiten beschreibt, dann liefert diese Methode die * Antwort auf die Frage, ob der Laden zur angegebenen Zeit offen ist. </p> * * @param timestamp the timestamp to be checked * @return {@code true} if given timestamp fits to this rule else {@code false} * @since 4.20 */ default boolean matches(PlainTimestamp timestamp) { for (ChronoInterval<PlainTime> interval : this.getPartition(timestamp.toDate())) { if (interval.contains(timestamp.toTime())) { return true; } } return false; }