Correct previous commit. We don't want to suppress an entry because

it runs into the following month.  Instead adjust month and day,
wrapping round into next year where necessary.

MFC after: 14 days
This commit is contained in:
grog 2006-05-31 01:30:50 +00:00
parent 51170c3bdd
commit 3a3622dbf7

View File

@ -361,6 +361,11 @@ isnow(endp, monthp, dayp, varp)
} }
if (!(flags & F_EASTER)) { if (!(flags & F_EASTER)) {
if (day + cumdays[month] > cumdays[month + 1]) { /* off end of month */
day -= (cumdays[month + 1] - cumdays[month]); /* adjust */
if (++month > 12) /* next year */
month = 1;
}
*monthp = month; *monthp = month;
*dayp = day; *dayp = day;
day = cumdays[month] + day; day = cumdays[month] + day;
@ -376,9 +381,6 @@ isnow(endp, monthp, dayp, varp)
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "day2: day %d(%d-%d) yday %d\n", *dayp, day, cumdays[month], tp->tm_yday); fprintf(stderr, "day2: day %d(%d-%d) yday %d\n", *dayp, day, cumdays[month], tp->tm_yday);
#endif #endif
if (day > cumdays [month + 1]) /* off end of month */
return (0);
/* if today or today + offset days */ /* if today or today + offset days */
if (day >= tp->tm_yday - f_dayBefore && if (day >= tp->tm_yday - f_dayBefore &&
day <= tp->tm_yday + offset + f_dayAfter) day <= tp->tm_yday + offset + f_dayAfter)