Date: Fri, 18 Feb 2011 13:41:45 +0000 (UTC) From: "Sergey A. Osokin" <osa@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r218797 - head/usr.bin/calendar Message-ID: <201102181341.p1IDfjEq059570@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: osa (ports committer) Date: Fri Feb 18 13:41:45 2011 New Revision: 218797 URL: http://svn.freebsd.org/changeset/base/218797 Log: Replace hard-coded value by Julian2Gregorian converter function. Modified: head/usr.bin/calendar/calendar.h head/usr.bin/calendar/paskha.c Modified: head/usr.bin/calendar/calendar.h ============================================================================== --- head/usr.bin/calendar/calendar.h Fri Feb 18 13:21:30 2011 (r218796) +++ head/usr.bin/calendar/calendar.h Fri Feb 18 13:41:45 2011 (r218797) @@ -170,6 +170,7 @@ FILE *opencal(void); /* ostern.c / paskha.c */ int paskha(int); int easter(int); +int j2g(int); /* dates.c */ extern int cumdaytab[][14]; Modified: head/usr.bin/calendar/paskha.c ============================================================================== --- head/usr.bin/calendar/paskha.c Fri Feb 18 13:21:30 2011 (r218796) +++ head/usr.bin/calendar/paskha.c Fri Feb 18 13:41:45 2011 (r218797) @@ -36,6 +36,15 @@ __FBSDID("$FreeBSD$"); #define PASKHA "paskha" #define PASKHALEN (sizeof(PASKHA) - 1) +/* return difference in days between Julian and Gregorian calendars */ +int +j2g(int year) +{ + return (year < 1500) ? + 0 : + 10 + (year/100 - 16) - ((year/100 - 16) / 4); +} + /* return year day for Orthodox Easter using Gauss formula */ /* (new style result) */ @@ -53,5 +62,5 @@ paskha(int R) /*year*/ d = (19 * a + x) % 30; e = (2 * b + 4 * c + 6 * d + y) % 7; cumday = cumdaytab[isleap(R)]; - return (((cumday[3] + 1) + 22) + (d + e) + 13); + return (((cumday[3] + 1) + 22) + (d + e) + j2g(R)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102181341.p1IDfjEq059570>