summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorosa <osa@FreeBSD.org>2011-02-18 13:41:45 +0000
committerosa <osa@FreeBSD.org>2011-02-18 13:41:45 +0000
commit1856110dc5d29373ef581edaf6d2f92392a12cd0 (patch)
treeb204ff29f0a603203b7456ad0ec377dbb1428942 /usr.bin
parentf790f344430af0b400f0823037071c8948f44e80 (diff)
downloadFreeBSD-src-1856110dc5d29373ef581edaf6d2f92392a12cd0.zip
FreeBSD-src-1856110dc5d29373ef581edaf6d2f92392a12cd0.tar.gz
Replace hard-coded value by Julian2Gregorian converter function.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/calendar/calendar.h1
-rw-r--r--usr.bin/calendar/paskha.c11
2 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/calendar/calendar.h b/usr.bin/calendar/calendar.h
index d01c066..a4903b1 100644
--- a/usr.bin/calendar/calendar.h
+++ b/usr.bin/calendar/calendar.h
@@ -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];
diff --git a/usr.bin/calendar/paskha.c b/usr.bin/calendar/paskha.c
index 98a4224..ab369ad 100644
--- a/usr.bin/calendar/paskha.c
+++ b/usr.bin/calendar/paskha.c
@@ -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));
}
OpenPOWER on IntegriCloud