hconverter
C code to convert dates between Hebrew, Gregorian and Julian calendars
hconverter.h
Go to the documentation of this file.
1 
17 #ifndef SRC_HCONVERTER_H_
18 #define SRC_HCONVERTER_H_
19 
23 typedef enum hc_day_of_week {SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
24  THURSDAY, FRIDAY, SATURDAY} hc_day_of_week;
32 typedef enum hc_calendar_type { NONE, GREGORIAN, JULIAN, HEBREW } hc_calendar_type;
33 
37 typedef struct hc_date_s {
38  hc_calendar_type calendar_type;
39  int year;
40  int month;
41  int day;
42 } hc_date;
43 
52 int set_hc_date(hc_date* , int year, int month, int day, hc_calendar_type);
53 
65 int hc_convert(hc_date *date, hc_calendar_type target_calendar);
66 
77 int hc_check(hc_date *date);
78 
90 int hc_is_leap_year(int year, hc_calendar_type calendar_type);
91 
99 
109 int hc_get_month_length(int year, int month, hc_calendar_type calendar_type);
110 
128 int hc_compute_keviut(const int year, int *rosh_hashana_dow, int *pesach_dow, int *ck, int *leap);
129 
137 typedef struct heb_time_s {
138  int hour;
139  int part;
140 } heb_time;
141 
149 int hc_set_hc_heb_time(heb_time* time, int hour, int part);
150 
162 int hc_compute_molad_rosh_hashana(int year, hc_calendar_type cal_type,
163  hc_date *date, heb_time *time);
164 
178 int hc_compute_molad(const int year, int month, const hc_calendar_type cal_type,
179  hc_date *date, heb_time *time);
180 
190 typedef enum heb_year_type {SHORT_HEB_YEAR, NORMAL_HEB_YEAR, FULL_HEB_YEAR} heb_year_type;
191 
192 
203 
250 #endif /* SRC_HCONVERTER_H_ */
Definition: hconverter.h:37
int hc_compute_molad(const int year, int month, const hc_calendar_type cal_type, hc_date *date, heb_time *time)
Compute the date and time of molad (new moon according to the Hebrew calendar) for given year and mon...
Definition: hebrew.c:261
struct hc_date_s hc_date
heb_year_type
enum of possible layouts of the variable length Hebrew months Cheshvan and Kislev in a given year...
Definition: hconverter.h:190
hc_day_of_week
Definition: hconverter.h:23
Hebrew time: hour and parts.
Definition: hconverter.h:137
int hc_compute_molad_rosh_hashana(int year, hc_calendar_type cal_type, hc_date *date, heb_time *time)
Compute the date time of molad of Rosh Hashana for given year.
Definition: hebrew.c:279
hc_calendar_type
Supported types of calendar.
Definition: hconverter.h:32
int hc_get_month_length(int year, int month, hc_calendar_type calendar_type)
Function to get the length of a month.
Definition: hconverter.c:68
hc_day_of_week hc_get_day_of_week(hc_date *date)
Function to get day of week out of a hc_date.
Definition: hconverter.c:61
int hc_set_hc_heb_time(heb_time *time, int hour, int part)
Convenience method to set heb_time struct value.
Definition: hebrew.c:13
int hc_compute_keviut(const int year, int *rosh_hashana_dow, int *pesach_dow, int *ck, int *leap)
Compute year "keviut" and put the result into 4 integers.
Definition: hebrew.c:285
heb_year_type hc_get_heb_year_type(int year)
Compute number of days in excess of 58 in Cheshvan and Kislev combined.
Definition: hebrew.c:192
int hc_check(hc_date *date)
Check validity of data in hc_date.
Definition: hconverter.c:49
int set_hc_date(hc_date *, int year, int month, int day, hc_calendar_type)
Definition: hconverter.c:10
int hc_convert(hc_date *date, hc_calendar_type target_calendar)
This function converts a date from one calendar to another.
Definition: hconverter.c:36
struct heb_time_s heb_time
Hebrew time: hour and parts.
int hc_is_leap_year(int year, hc_calendar_type calendar_type)
Check if year is leap in given calendar.
Definition: hconverter.c:55