{
// next begin > next end means we are at the begin or within the interval
- time_t interval_begin=get_lastnow_point(calc_from,Begin,true);
+ time_t interval_begin=get_previousnow_point(calc_from,Begin,true);
time_t within_interval=calc_from - interval_begin;
time_t since_lastrun=within_interval % Every;
}
/**
- * Returns the next point in time the item is scheduled for
+ * Returns the next point in time the item is scheduled for.
+ * Returns next point if scheduled for #calc_from.
* @param calc_from Point of time to start calculations from
* @param daysec Start point of time in seconds since the start of the day
* @param todaycheck If true we check if the calculated time point is before
}
/**
- * Returns the last point in time the item is scheduled for
+ * Returns the previous or current point in time the item was scheduled for.
+ * Returns #calc_from if scheduled for #calc_from.
* @param calc_from Point of time to start calculations from
* @param daysec Start point of time in seconds since the start of the day
- * @param todaycheck If true we check if the calculated time point is before
+ * @param todaycheck If true we check if the calculated time point is after
our #calc_from calcucation start point.
- If yes, we will advance to the next day.
- * @return Last point in time
- * FIXME: Is the description correct?
+ If yes, we will go back to the previos day
+ * @return Previous point in time
*/
-time_t WeekCron::get_lastnow_point(time_t calc_from, int daysec, bool todaycheck)
+time_t WeekCron::get_previousnow_point(time_t calc_from, int daysec, bool todaycheck)
{
struct tm ft;
localtime_r(&calc_from,&ft);
// not today but the next matching weekday
localtime_r(&calc_from,&ft);
ft.tm_mday--;
- return get_next_point(mktime(&ft),daysec,false);
+ return get_previousnow_point(mktime(&ft),daysec,false);
}
return target;
WEEK Week;
time_t get_next_point(time_t calc_from, int daysec,bool todaycheck);
- time_t get_lastnow_point(time_t calc_from, int daysec,bool todaycheck);
+ time_t get_previousnow_point(time_t calc_from, int daysec,bool todaycheck);
public:
WeekCron(const std::string& daystring, int begin);