Andy Bradford wrote: > And here is the patch: > > Index: calendar/day.c > =================================================================== > RCS file: /home/cvs/src/usr.bin/calendar/day.c,v > retrieving revision 1.32 > diff -u -p -r1.32 day.c > --- calendar/day.c 8 Dec 2015 19:04:50 -0000 1.32 > +++ calendar/day.c 9 Jul 2016 20:53:13 -0000 > @@ -543,8 +543,9 @@ isnow(char *endp, int bodun) > tdiff = difftime(ttmp, f_time)/ SECSPERDAY; > if (tdiff <= offset + f_dayAfter || > (bodun && tdiff == -1)) { > - if (tdiff >= 0 || > - (bodun && tdiff == -1)) { > + if ((tmtmp.tm_mon == month) && > + (tdiff >= 0 || > + (bodun && tdiff == -1))) { > if ((tmp = malloc(sizeof(struct > match))) == NULL) > err(1, NULL); > tmp->when = ttmp; > > This works because when variable_weekday returns it places a value in v1 > that is larger than a month's worth of days. For example, for July 1, > 2016, Sunday+5 gets a value of 33 in tmtmp.tm_mday for which mktime > advances advances the month to account for the extra days when creating > the timestamp. Now the months are different and should probably not > count as a match.
That makes sense. I guess the failure to check month was an oversight, not expecting it could change.