#ifndef _JD_H
#define _JD_H

#define JD_ONE_HOUR (1.0/24.0)
#define JD_12_HOURS (0.5)
#define MINUTES_TO_JD(a) ((a)/1440.0)
#define HOURS_TO_JD(a)   ((a)/24.0)
#define JD_TO_MINUTES(a) ((a)*1440.0)

typedef enum weekday_type {
	sunday, monday, tuesday, wednesday,
	thursday, friday, saturday 
	} weekday_type;

typedef enum occurence_type {
	first, second, third, fourth, last
	} occurence_type;

weekday_type
jd_2_day_of_week(double jd);

double
gregorian_to_jd( const int iYear, const int iMonth, const int iDay,
		 const int iHour, const int iMinute, const int iSecond,
		 const double hour_correction );

void
jyear(double td, int *yy, int *mm, int *dd);

void
jhms(double j, int *h, int *m, int *s);

#ifdef ALL
void
jhm_rounded (double j, int *h, int *m);


weekday_type
date_2_day_of_week(const int the_year, const int the_month, const int the_day);

#endif

double
find_jd_day_in_month (occurence_type the_occurence,
		   weekday_type the_weekday,
		   int the_month,
		   int the_year);
		   
int
find_day_in_month (occurence_type the_occurence,
		   weekday_type the_weekday,
		   int the_month,
		   int the_year);

#endif