| Línea 628... |
Línea 628... |
| 628 |
}
|
628 |
}
|
| Línea 629... |
Línea 629... |
| 629 |
|
629 |
|
| 630 |
$currenthour = (int)date('H', $now);
|
630 |
$currenthour = (int)date('H', $now);
|
| 631 |
$nextvalidhour = $this->next_in_list($currenthour, $validhours);
|
631 |
$nextvalidhour = $this->next_in_list($currenthour, $validhours);
|
| 632 |
if ($nextvalidhour != $currenthour) {
|
632 |
if ($nextvalidhour != $currenthour) {
|
| 633 |
if ($nextvalidhour < $currenthour) {
|
633 |
$keepcurrent = false;
|
| 634 |
$offset = ' +1 day';
|
634 |
$currentdate = new \DateTimeImmutable($currentyear . '-' . $currentmonth . '-' . $currentday . ' ' . $currenthour .
|
| - |
|
635 |
':00');
|
| - |
|
636 |
$lasthour = (int)date('H', $currentdate->sub(new \DateInterval('PT1S'))->getTimestamp());
|
| - |
|
637 |
$nextafterlast = $this->next_in_list($lasthour, $validhours);
|
| - |
|
638 |
// Special case for when the clocks go forward. If the next scheduled time would fall in an hour
|
| - |
|
639 |
// that doesn't exist due to the clock change, then we use the next existing hour so that we don't
|
| - |
|
640 |
// skip a run. However, the replacement hour may not appear in the valid hours list, so we check
|
| - |
|
641 |
// whether we skipped a valid hour here to avoid recursing again and skipping its replacement.
|
| 635 |
} else {
|
642 |
if (($lasthour + 1) % 24 <= $nextafterlast && $nextafterlast < $currenthour) {
|
| 636 |
$offset = '';
|
643 |
$keepcurrent = true;
|
| - |
|
644 |
}
|
| - |
|
645 |
if (!$keepcurrent) {
|
| - |
|
646 |
if ($nextvalidhour < $currenthour) {
|
| - |
|
647 |
$offset = ' +1 day';
|
| - |
|
648 |
} else {
|
| - |
|
649 |
$offset = '';
|
| 637 |
}
|
650 |
}
|
| 638 |
$newtime = strtotime($currentyear . '-' . $currentmonth . '-' . $currentday . ' ' . $nextvalidhour .
|
651 |
$newtime = strtotime($currentyear . '-' . $currentmonth . '-' . $currentday . ' ' . $nextvalidhour .
|
| 639 |
':00' . $offset);
|
652 |
':00' . $offset);
|
| 640 |
return $this->get_next_scheduled_time_inner($newtime, $validminutes, $validhours, $validdays,
|
653 |
return $this->get_next_scheduled_time_inner($newtime, $validminutes, $validhours, $validdays,
|
| - |
|
654 |
$validdaysofweek, $validmonths, $firstyear);
|
| 641 |
$validdaysofweek, $validmonths, $firstyear);
|
655 |
}
|
| Línea 642... |
Línea 656... |
| 642 |
}
|
656 |
}
|
| 643 |
|
657 |
|
| 644 |
// Round time down to an exact minute because we need to use numeric calculations on it now.
|
658 |
// Round time down to an exact minute because we need to use numeric calculations on it now.
|