9fans archive / 1996 / 09 / 24 / prev next
From: Russ Cox rsc@res...
Subject: bug in calendar(1) on saturday.
Date: Wed, 11 Sep 1996 23:30:10 -0400 (EDT)
The /sys/src/cmd/calendar.c shipped on the CD behaves as
follows. During the week (Sunday-Thursday) it prints today's
events and tomorrow's. On Friday, it prints events for
Friday, Saturday, and Sunday, and Monday. On Saturday, however,
it prints events for Saturday, Sunday, and Tuesday. This does
not agree with the man page.
A fix (pseudo-diff):
tm = localtime(now+24*60*60);
dates(&last, tm);
if(tm->wday == 6){
tm = localtime(now+2*24*60*60);
dates(&last, tm);
}
if(tm->wday == 0){
tm = localtime(now+3*24*60*60);
dates(&last, tm);
}
becomes
tm = localtime(now+=24*60*60);
dates(&last, tm);
if(tm->wday == 6){
tm = localtime(now+=24*60*60);
dates(&last, tm);
}
if(tm->wday == 0){
tm = localtime(now+=24*60*60);
dates(&last, tm);
}
Russ