aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/calendar/ostern.c
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2010-08-23 22:09:25 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2010-08-23 22:09:25 +0000
commitc542a3f449df7bee48f531073fad64849199531c (patch)
tree8f1dbe9d94194e413cd21ccb4322498c4db08586 /usr.bin/calendar/ostern.c
parent16baa5ca51be9ca09bbfbf81a370c8b4564c6213 (diff)
downloadsrc-c542a3f449df7bee48f531073fad64849199531c.tar.gz
src-c542a3f449df7bee48f531073fad64849199531c.zip
MFC of r205821 r205827 r205828 r205862 r205872 r205937 r206568
MFC of r208825 r208826 r208827 r208828 r208829 r208943 r205821: Long awaited update to the calendar system: - Repeating events which span multiple years (because of -A, -B or just the three days before the end of the year). - Support for lunar events (full moon, new moon) and solar events (equinox and solstice, chinese new year). Because of this, the options -U (UTC offset) and -l (longitude) are available to compensate if reality doesn't match the calculated values. r205828: Use local names for calendar.dutch r205862: Fix DST thingies in calendar.australia r205872: Make licenses 3 clause instead of 4 clause r205937: Make the dates in the Tasmanian part of calendar.australia properly variable. r206568: Typo in Allerheiligen in calendar.dutch r208825, r208826, r208827, r208828, r208829, r208943: Coverity Prevent related fixes.
Notes
Notes: svn path=/stable/8/; revision=211723
Diffstat (limited to 'usr.bin/calendar/ostern.c')
-rw-r--r--usr.bin/calendar/ostern.c47
1 files changed, 2 insertions, 45 deletions
diff --git a/usr.bin/calendar/ostern.c b/usr.bin/calendar/ostern.c
index 76e593327a39..3cce2998f12a 100644
--- a/usr.bin/calendar/ostern.c
+++ b/usr.bin/calendar/ostern.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* All rights reserved.
*
@@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "calendar.h"
@@ -61,50 +60,8 @@ easter(int year) /* 0 ... abcd, NOT since 1900 */
L = I - J;
- if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
+ if (isleap(year))
return 31 + 29 + 21 + L + 7;
else
return 31 + 28 + 21 + L + 7;
}
-
-/* return year day for Easter or easter depending days
- * Match: Easter([+-][0-9]+)?
- * e.g: Easter-2 is Good Friday (2 days before Easter)
- */
-
-int
-geteaster(char *s, int year)
-{
- int offset = 0;
-
-#define EASTER "easter"
-#define EASTERNAMELEN (sizeof(EASTER) - 1)
-
- if (strncasecmp(s, EASTER, EASTERNAMELEN) == 0)
- s += EASTERNAMELEN;
- else if (neaster.name != NULL
- && strncasecmp(s, neaster.name, neaster.len) == 0)
- s += neaster.len;
- else
- return (0);
-
-#if DEBUG
- printf("%s %d %d\n", s, year, EASTERNAMELEN);
-#endif
-
- /* Easter+1 or Easter-2
- * ^ ^ */
-
- switch (*s) {
-
- case '-':
- case '+':
- offset = atoi(s);
- break;
-
- default:
- offset = 0;
- }
-
- return (easter(year) + offset);
-}