21 return datetime_error(-1,
"datetime_is_leap_year(): illegal year");
27 return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
44 return datetime_error(-1,
"datetime_days_in_year(): illegal year");
66 static int days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
68 if (month < 1 || month > 12)
69 return datetime_error(-1,
"datetime_days_in_month(): illegal month");
74 return (days[month - 1]);
int datetime_error(int code, char *msg)
record 'code' and 'msg' as error code/msg (in static variables) code==0 will clear the error (ie set ...
int datetime_days_in_year(int year, int ad)
returns the number of days in 'year'
int datetime_days_in_month(int year, int month, int ad)
returns number of days in 'month' of a particular 'year'
int datetime_is_leap_year(int year, int ad)