bstrncpy(buf, " mday=", sizeof(buf));
for (i=0; i<31; i++) {
if (bit_is_set(i, run->mday)) {
- sprintf(num, "%d ", i+1);
+ sprintf(num, "%d ", i);
bstrncat(buf, num, sizeof(buf));
}
}
bstrncpy(buf, " month=", sizeof(buf));
for (i=0; i<12; i++) {
if (bit_is_set(i, run->month)) {
- sprintf(num, "%d ", i+1);
+ sprintf(num, "%d ", i);
bstrncat(buf, num, sizeof(buf));
}
}
bstrncpy(buf, " wday=", sizeof(buf));
for (i=0; i<7; i++) {
if (bit_is_set(i, run->wday)) {
- sprintf(num, "%d ", i+1);
+ sprintf(num, "%d ", i);
bstrncat(buf, num, sizeof(buf));
}
}
bstrncpy(buf, " wom=", sizeof(buf));
for (i=0; i<5; i++) {
if (bit_is_set(i, run->wom)) {
- sprintf(num, "%d ", i+1);
+ sprintf(num, "%d ", i);
bstrncat(buf, num, sizeof(buf));
}
}
mday = tm.tm_mday - 1;
wday = tm.tm_wday;
month = tm.tm_mon;
- wom = tm_wom(tm.tm_mday, tm.tm_wday); /* get week of month */
+ wom = mday / 7;
woy = tm_woy(now); /* get week of year */
/*
nh_wday = tm.tm_wday;
nh_month = tm.tm_mon;
nh_year = tm.tm_year;
- nh_wom = tm_wom(tm.tm_mday, tm.tm_wday); /* get week of month */
+ nh_wom = nh_mday / 7;
nh_woy = tm_woy(now); /* get week of year */
/* Loop through all jobs */
mday = tm.tm_mday - 1;
wday = tm.tm_wday;
month = tm.tm_mon;
- wom = tm_wom(tm.tm_mday, tm.tm_wday);
+ wom = mday / 7;
woy = tm_woy(now);
/* Break down tomorrow into components */
tmday = tm.tm_mday - 1;
twday = tm.tm_wday;
tmonth = tm.tm_mon;
- twom = tm_wom(tm.tm_mday, tm.tm_wday);
+ twom = tmday / 7;
twoy = tm_woy(tomorrow);
if (run == NULL) {
bit_is_set(tmonth, run->month) && bit_is_set(twom, run->wom) &&
bit_is_set(twoy, run->woy);
- Dmsg2(200, "tod=%d tom=%d\n", tod, tom);
+// Dmsg2(200, "tod=%d tom=%d\n", tod, tom);
+// Dmsg2(200, "wom=%d twom=%d\n", wom, twom);
+// Dmsg1(200, "bit_set_wom=%d\n", bit_is_set(wom, run->wom));
if (tod) { /* Jobs scheduled today (next 24 hours) */
/* find time (time_t) job is to be run */
localtime_r(&now, &tm);
tm.tm_sec = 0;
runtime = mktime(&tm);
if (runtime > now) {
+ Dmsg2(000, "Found it level=%d %c\n", run->level, run->level);
return run; /* found it, return run resource */
}
}
}
/*
- * Return the week of the month, base 0 (wpos)
+ * Return the week of the month, base 0 (wom)
* given tm_mday and tm_wday. Value returned
* can be from 0 to 4 => week1, ... week5
*/
fs += 7;
}
if (mday <= fs) {
-// Dmsg2(100, "wom=0 wday=%d <= fs=%d\n", wday, fs);
+// Dmsg3(100, "mday=%d wom=0 wday=%d <= fs=%d\n", mday, wday, fs);
return 0;
}
int wom = 1 + (mday - fs - 1) / 7;
-// Dmsg3(100, "wom=%d wday=%d fs=%d\n", wom, wday, fs);
+// Dmsg4(100, "mday=%d wom=%d wday=%d fs=%d\n", mday, wom, wday, fs);
return wom;
}