Files
lunar-calendar/c/lunarcalbase.h
Chen Wei cd4c8c9ec5 use multiple threads in lea406 computing
test on 4-core-4-hyperthread i5 and 2-core-4-hyperthread i5, the speed of
generating lunar calendar almost doubled.
2014-04-01 21:50:08 +08:00

38 lines
861 B
C

#define MAX_SOLARTERMS 27
#define MAX_NEWMOONS 15
#define MAX_DAYS 450
#define CACHESIZE 3
#define TZ_CN 8
struct lunarcal {
double jd;
int solarterm; /* index of solarterm */
int month; /* month in Lunar Calendar */
int day; /* day in Lunar Calendar */
};
struct lunarcal_cache { /* the item in cache */
int year;
int len; /* days count of this cached lunar calendar */
struct lunarcal *lcs[MAX_DAYS]; /* the cached lunar calendar */
};
/* Function prototypes */
void cn_lunarcal(int year);
int get_cached_lc(struct lunarcal *p[], int year);
double normjd(double jd, double tz);
int find_leap(void);
int mark_month_day(struct lunarcal *lcs[]);
struct lunarcal *lcalloc(double jd);
void print_lunarcal(struct lunarcal *p[], int len);
int get_cache_index(int year);
void init_cache(void);