Commit f0094c13 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

calendar.c: move date_to_calday() and calday_to_date() to TEST branch

parent 715c6150
......@@ -129,79 +129,79 @@ static int encode_day(int dpy, int year, int month, int day)
}
static int date_to_calday(int calendar, int date)
void encode_caldaysec(int calendar, int year, int month, int day, int hour, int minute, int second,
int *julday, int *secofday)
{
int calday;
int dpy;
int year, month, day;
dpy = calendar_dpy(calendar);
cdiDecodeDate(date, &year, &month, &day);
if ( dpy == 360 || dpy == 365 || dpy == 366 )
calday = encode_day(dpy, year, month, day);
*julday = encode_day(dpy, year, month, day);
else
calday = encode_julday(calendar, year, month, day);
*julday = encode_julday(calendar, year, month, day);
return (calday);
*secofday = hour*3600 + minute*60 + second;
}
static int calday_to_date(int calendar, int calday)
void decode_caldaysec(int calendar, int julday, int secofday,
int *year, int *month, int *day, int *hour, int *minute, int *second)
{
int date;
int dpy;
int year, month, day;
dpy = calendar_dpy(calendar);
if ( dpy == 360 || dpy == 365 || dpy == 366 )
decode_day(dpy, calday, &year, &month, &day);
decode_day(dpy, julday, year, month, day);
else
decode_julday(calendar, calday, &year, &month, &day);
date = cdiEncodeDate(year, month, day);
decode_julday(calendar, julday, year, month, day);
return (date);
*hour = secofday/3600;
*minute = secofday/60 - *hour*60;
*second = secofday - *hour*3600 - *minute*60;
}
void encode_caldaysec(int calendar, int year, int month, int day, int hour, int minute, int second,
int *julday, int *secofday)
#ifdef TEST
static int date_to_calday(int calendar, int date)
{
int calday;
int dpy;
int year, month, day;
dpy = calendar_dpy(calendar);
cdiDecodeDate(date, &year, &month, &day);
if ( dpy == 360 || dpy == 365 || dpy == 366 )
*julday = encode_day(dpy, year, month, day);
calday = encode_day(dpy, year, month, day);
else
*julday = encode_julday(calendar, year, month, day);
calday = encode_julday(calendar, year, month, day);
*secofday = hour*3600 + minute*60 + second;
return (calday);
}
void decode_caldaysec(int calendar, int julday, int secofday,
int *year, int *month, int *day, int *hour, int *minute, int *second)
static int calday_to_date(int calendar, int calday)
{
int date;
int dpy;
int year, month, day;
dpy = calendar_dpy(calendar);
if ( dpy == 360 || dpy == 365 || dpy == 366 )
decode_day(dpy, julday, year, month, day);
decode_day(dpy, calday, &year, &month, &day);
else
decode_julday(calendar, julday, year, month, day);
decode_julday(calendar, calday, &year, &month, &day);
*hour = secofday/3600;
*minute = secofday/60 - *hour*60;
*second = secofday - *hour*3600 - *minute*60;
date = cdiEncodeDate(year, month, day);
return (date);
}
#ifdef TEST
int main(void)
{
int calendar = CALENDAR_STANDARD;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment