Browse Source

Polish contribution

See gh-28038
pull/28119/head
Arjen Poutsma 3 years ago
parent
commit
5ab966fbde
  1. 10
      spring-context/src/main/java/org/springframework/scheduling/support/CronField.java

10
spring-context/src/main/java/org/springframework/scheduling/support/CronField.java

@ -260,7 +260,7 @@ abstract class CronField {
* Roll forward the give temporal until it reaches the next higher * Roll forward the give temporal until it reaches the next higher
* order field. Calling this method is equivalent to calling * order field. Calling this method is equivalent to calling
* {@link #elapseUntil(Temporal, int)} with goal set to the * {@link #elapseUntil(Temporal, int)} with goal set to the
* minimum value of this field's range, except for daylight saving. * minimum value of this field's range.
* @param temporal the temporal to roll forward * @param temporal the temporal to roll forward
* @param <T> the type of temporal * @param <T> the type of temporal
* @return the rolled forward temporal * @return the rolled forward temporal
@ -270,9 +270,11 @@ abstract class CronField {
ValueRange range = temporal.range(this.field); ValueRange range = temporal.range(this.field);
long amount = range.getMaximum() - current + 1; long amount = range.getMaximum() - current + 1;
T result = this.field.getBaseUnit().addTo(temporal, amount); T result = this.field.getBaseUnit().addTo(temporal, amount);
//adjust daylight saving current = get(result);
if (get(result) != range.getMinimum()) { range = result.range(this.field);
result = this.field.adjustInto(result,result.range(this.field).getMinimum()); // adjust for daylight savings
if (current != range.getMinimum()) {
result = this.field.adjustInto(result, range.getMinimum());
} }
return result; return result;
} }

Loading…
Cancel
Save