Mass update FSF address
[dockapps.git] / wmcalendar / Src / calendarfunc.h
blobabd0ba53d362cdeade0c05c95d160bfc67bf206b
1 /* persian calendar functions original code is by Kees Couprie
2 http://www.geocities.com/couprie/calmath/ */
4 /* islamic conversion and moonphase calculation is taken from
6 * hdate
8 * Copyright (c) 1992 by Waleed A. Muhanna
10 * Permission for nonprofit use and redistribution of this software and
11 * its documentation is hereby granted without fee, provided that the
12 * above copyright notice appear in all copies and that both that copyright
13 * notice and this permission notice appear in supporting documentation.
15 * No representation is made about the suitability of this software for any
16 * purpose. It is provided "as is" without express or implied warranty.
18 * Send any comments/suggestions/fixes/additions to:
19 * wmuhanna@magnus.acs.ohio-state.edu
23 #include <unistd.h>
24 #include <stdlib.h>
25 #include <ical.h>
26 #define TIMZ 3.0
27 #define MINAGE 13.5
28 #define SUNSET 19.5 /*approximate */
29 #define TIMDIF (SUNSET-MINAGE)
30 #define NMONTHS (1405*12+1)
31 #define RPD (0.01745329251994329577) /* radians per degree (pi/180) */
32 /*general*/
33 int days_in_month(int month, int year, int calendar);
34 int day_of_week(struct icaltimetype dt);
36 /* related to gregorian calendar*/
37 struct icaltimetype get_civil(struct icaltimetype dt, int calendar);
38 long civil_jdn(struct icaltimetype dt);
39 struct icaltimetype jdn_civil(long jdn);
40 int isGregorianLeap(int year);
41 int days_in_gregorian_month(int month, int year);
43 /*related to persian calendar*/
44 long persian_jdn(struct icaltimetype dt);
45 struct icaltimetype jdn_persian(long jdn);
46 struct icaltimetype civil_persian(struct icaltimetype dt);
47 struct icaltimetype persian_civil(struct icaltimetype dt);
48 int isPersianLeap(int year);
49 int days_in_persian_month(int month, int year);
51 /*related to islamic calendar*/
52 long islamic_jdn(struct icaltimetype dt);
53 struct icaltimetype jdn_islamic(long jdn);
54 struct icaltimetype civil_islamic(struct icaltimetype dt);
55 struct icaltimetype islamic_civil(struct icaltimetype dt);
56 int days_in_islamic_month(int month, int year);
59 /*moonphase*/
60 int moon(struct icaltimetype dt);
63 /*day comparing functions*/
64 int daysComp(struct icaltimetype d1, struct icaltimetype d2);
65 int daysEqual(struct icaltimetype d1, struct icaltimetype d2);
66 int daysLater(struct icaltimetype d1, struct icaltimetype d2);
67 int daysEarlier(struct icaltimetype d1, struct icaltimetype d2);
68 int daysLaterEqual(struct icaltimetype d1, struct icaltimetype d2);
69 int daysEarlierEqual(struct icaltimetype d1, struct icaltimetype d2);
71 int Ceil(float number);
73 int datemoon[200][2]; /* hashtable for moonphase.[jdn%32][0] stores moonphase of day jdn,
74 [jdn%32][1] stores jdn. */