Localize even more.
FIx Orthodox Easter calculation Better debug output
This commit is contained in:
parent
26dd43d3f9
commit
d6a4dd4bb2
@ -101,10 +101,6 @@ void setnnames(void)
|
||||
free(fndays[i].name);
|
||||
fndays[i].name = strdup(buf);
|
||||
fndays[i].len = strlen(buf);
|
||||
#ifdef DEBUG
|
||||
printf("ndays[%d] = %s, fndays[%d] = %s\n",
|
||||
i, ndays[i].name, i, fndays[i].name);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
@ -130,10 +126,6 @@ void setnnames(void)
|
||||
free(fnmonths[i].name);
|
||||
fnmonths[i].name = strdup(buf);
|
||||
fnmonths[i].len = strlen(buf);
|
||||
#ifdef DEBUG
|
||||
printf("nmonths[%d] = %s, fnmonths[%d] = %s\n",
|
||||
i, nmonths[i].name, i, fnmonths[i].name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,6 +169,7 @@ time_t Mktime (date)
|
||||
tm.tm_sec = 0;
|
||||
tm.tm_min = 0;
|
||||
tm.tm_hour = 0;
|
||||
tm.tm_wday = 0;
|
||||
tm.tm_mday = tp->tm_mday;
|
||||
tm.tm_mon = tp->tm_mon;
|
||||
tm.tm_year = tp->tm_year;
|
||||
@ -356,9 +349,6 @@ isnow(endp, monthp, dayp, varp)
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
fprintf(stderr, "day2: day %d yday %d\n", day, tp->tm_yday);
|
||||
#endif
|
||||
if (!(flags & F_EASTER)) {
|
||||
*monthp = month;
|
||||
*dayp = day;
|
||||
@ -372,6 +362,9 @@ isnow(endp, monthp, dayp, varp)
|
||||
*varp = 1;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
fprintf(stderr, "day2: day %d(%d) yday %d\n", *dayp, day, tp->tm_yday);
|
||||
#endif
|
||||
/* if today or today + offset days */
|
||||
if (day >= tp->tm_yday - f_dayBefore &&
|
||||
day <= tp->tm_yday + offset + f_dayAfter)
|
||||
|
@ -129,9 +129,23 @@ cal()
|
||||
continue;
|
||||
if (p > buf && p[-1] == '*')
|
||||
var = 1;
|
||||
if (printing)
|
||||
(void)fprintf(fp, "%.2d/%.2d%c%s\n", month,
|
||||
day, var ? '*' : ' ', p);
|
||||
if (printing) {
|
||||
struct tm tm;
|
||||
char dbuf[30];
|
||||
|
||||
tm.tm_sec = 0; /* unused */
|
||||
tm.tm_min = 0; /* unused */
|
||||
tm.tm_hour = 0; /* unused */
|
||||
tm.tm_wday = 0; /* unused */
|
||||
tm.tm_mon = month - 1;
|
||||
tm.tm_mday = day;
|
||||
tm.tm_year = tp->tm_year; /* unused */
|
||||
(void)strftime(dbuf, sizeof(dbuf), "%c", &tm);
|
||||
dbuf[10] = '\0';
|
||||
(void)fprintf(fp, "%s%c%s\n",
|
||||
dbuf + 4/* skip weekdays */,
|
||||
var ? '*' : ' ', p);
|
||||
}
|
||||
}
|
||||
else if (printing)
|
||||
fprintf(fp, "%s\n", buf);
|
||||
|
@ -50,7 +50,7 @@ int R; /*year*/
|
||||
c = R % 7;
|
||||
d = (19*a + x) % 30;
|
||||
e = (2*b + 4*c + 6*d + y) % 7;
|
||||
return ((cumdays[2/*feb*/] + 22/*mar*/) + (d + e));
|
||||
return (((cumdays[3] + 1) + 22) + (d + e));
|
||||
}
|
||||
|
||||
/* return year day for Orthodox Easter depending days */
|
||||
|
Loading…
Reference in New Issue
Block a user