Browse Source

Polish contribution

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

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

@ -260,7 +260,7 @@ abstract class CronField { @@ -260,7 +260,7 @@ abstract class CronField {
* Roll forward the give temporal until it reaches the next higher
* order field. Calling this method is equivalent to calling
* {@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 <T> the type of temporal
* @return the rolled forward temporal
@ -269,10 +269,12 @@ abstract class CronField { @@ -269,10 +269,12 @@ abstract class CronField {
int current = get(temporal);
ValueRange range = temporal.range(this.field);
long amount = range.getMaximum() - current + 1;
T result = this.field.getBaseUnit().addTo(temporal, amount);
//adjust daylight saving
if (get(result) != range.getMinimum()) {
result = this.field.adjustInto(result,result.range(this.field).getMinimum());
T result = this.field.getBaseUnit().addTo(temporal, amount);
current = get(result);
range = result.range(this.field);
// adjust for daylight savings
if (current != range.getMinimum()) {
result = this.field.adjustInto(result, range.getMinimum());
}
return result;
}

Loading…
Cancel
Save