diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1998-11-05 04:44:09 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1998-11-05 04:44:09 +0000 |
commit | e5553154f7b34bbec40fe04a821df208638ff540 (patch) | |
tree | c75c196fed718bca74ffe56eed012326e3a006c4 /usr.bin/calendar | |
parent | 86774a8c9cb493dd785d351d886579d53b3f99d1 (diff) |
Easter and Y2K leap year fix
Diffstat (limited to 'usr.bin/calendar')
-rw-r--r-- | usr.bin/calendar/ostern.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.bin/calendar/ostern.c b/usr.bin/calendar/ostern.c index 3d27000b169..088dbc9b96b 100644 --- a/usr.bin/calendar/ostern.c +++ b/usr.bin/calendar/ostern.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ostern.c,v 1.1 1996/12/05 06:04:40 millert Exp $ */ +/* $OpenBSD: ostern.c,v 1.2 1998/11/05 04:44:08 pjanzen Exp $ */ /* * Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin. @@ -25,11 +25,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ostern.c,v 1.1 1996/12/05 06:04:40 millert Exp $ + * $Id: ostern.c,v 1.2 1998/11/05 04:44:08 pjanzen Exp $ */ #ifndef lint -static char rcsid[] = "$OpenBSD: ostern.c,v 1.1 1996/12/05 06:04:40 millert Exp $"; +static char rcsid[] = "$OpenBSD: ostern.c,v 1.2 1998/11/05 04:44:08 pjanzen Exp $"; #endif /* not lint */ #include <stdio.h> @@ -47,6 +47,7 @@ int easter (year) int e_a, e_b, e_c, e_d, e_e,e_f, e_g, e_h, e_i, e_k, e_l, e_m, e_n, e_p, e_q; + extern int *cumdays; /* silly, but it works */ e_a = year % 19; @@ -66,16 +67,11 @@ int easter (year) e_p = (e_h + e_l + 114 - (7 * e_m)) % 31; e_p = e_p + 1; - e_q = 31 + 28; - - if (e_k == 0 && e_c != 0) - e_q += 1; + e_q = cumdays[3] + 1 + e_p; if (e_n == 4) e_q += 31; - e_q += e_p; - #if DEBUG printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", e_a , e_b , e_c , e_d , e_e , e_f , e_g , e_h , e_i , e_k , e_l , e_m , e_n , e_p , e_q); #endif |