mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
B #?: Fix repeat periods
(cherry picked from commit 7a00d16631e8a3611c1cfdb60a7131e4bf1273fe)
This commit is contained in:
parent
9ada269303
commit
08447071f0
@ -357,7 +357,7 @@ time_t SchedAction::next_action()
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Check if action is already finished */
|
||||
/* --------------------------------------------------------------------- */
|
||||
int end_value;
|
||||
time_t end_value;
|
||||
int rc = vector_value("END_VALUE", end_value);
|
||||
|
||||
if ( rc == -1 && eo != NEVER)
|
||||
@ -425,26 +425,26 @@ time_t SchedAction::next_action()
|
||||
|
||||
case HOURLY:
|
||||
case NONE:
|
||||
break;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::set<int>::iterator it = _days.lower_bound(cday);
|
||||
|
||||
int delta = 0;
|
||||
|
||||
if (it == _days.end()) //after last day in range
|
||||
if (cday < *(_days.begin())) //before first day in range
|
||||
{
|
||||
delta = *(_days.begin()) - cday;
|
||||
}
|
||||
else if (cday >= *(_days.rbegin())) //after or last day in range
|
||||
{
|
||||
int pdays = days_in_period(r, current_tm.tm_mon, current_tm.tm_year);
|
||||
|
||||
delta = pdays - cday + *(_days.begin()); //assume start day is 0
|
||||
}
|
||||
else if (cday < *(_days.begin())) //before first day in range
|
||||
else //day in range
|
||||
{
|
||||
delta = *(_days.begin()) - cday;
|
||||
}
|
||||
else if (*it != cday ) //is not today
|
||||
{
|
||||
delta = *it - cday;
|
||||
std::set<int>::iterator nday = _days.upper_bound(cday);
|
||||
|
||||
delta = *nday - cday;
|
||||
}
|
||||
|
||||
action_time += delta * 24 * 3600;
|
||||
|
Loading…
x
Reference in New Issue
Block a user