starting_tm.tm_mon = month;
starting_tm.tm_mday = day;
thetime = mktime(&starting_tm);
+ lprintf(9, "Starting at %s", asctime(localtime(&thetime)));
tm = &starting_tm;
while (tm->tm_mday != 1) {
thetime = thetime - (time_t)86400; /* go back 24 hours */
+ lprintf(9, "Backing off to %s", asctime(localtime(&thetime)));
tm = localtime(&thetime);
}
/* Determine previous and next months ... for links */
previous_month = thetime - (time_t)864000L; /* back 10 days */
next_month = thetime + (time_t)(31L * 86400L); /* ahead 31 days */
+ lprintf(9, "previous month is %s", asctime(localtime(&previous_month)));
+ lprintf(9, "next month is %s", asctime(localtime(&next_month)));
/* Now back up until we're on a Sunday */
tm = localtime(&thetime);
while (tm->tm_wday != 0) {
thetime = thetime - (time_t)86400; /* go back 24 hours */
+ lprintf(9, "Backing off to %s", asctime(localtime(&thetime)));
tm = localtime(&thetime);
}