FreeBSD/contrib/ntp/libntp/ntp_calendar.c
/*
 *---------------------------------------------------------------------
 * Convert ELAPSED years/months/days of gregorian calendar to elapsed
 * days in Gregorian epoch.
 *
 * If you want to convert years and days-of-year, just give a month of
 * zero.
 *---------------------------------------------------------------------
 */
Convert ELAPSED years/months/days of gregorian calendar to elapsed
days in Gregorian epoch.

If you want to convert years and days-of-year, just give a month of
zero.
Convert ELAPSED years / months / days of gregorian calendar to elapsed days in Gregorian epoch . If you want to convert years and days - of - year just give a month of zero .
int32_t
ntpcal_edate_to_eradays(
	int32_t years,
	int32_t mons,
	int32_t mdays
	)
{
	ntpcal_split tmp;
	int32_t	     res;
	if (mons) {
		tmp = ntpcal_days_in_months(mons);
		res = ntpcal_days_in_years(years + tmp.hi) + tmp.lo;
	} else
		res = ntpcal_days_in_years(years);
	res += mdays;
	return res;
}
int32_t ntpcal_edate_to_eradays ( int32_t years , int32_t mons , int32_t mdays ) { ntpcal_split tmp ; int32_t res ; if ( mons ) { tmp = ntpcal_days_in_months ( mons ) ; res = ntpcal_days_in_years ( years + tmp . hi ) + tmp . lo ; } else res = ntpcal_days_in_years ( years ) ; res += mdays ; return res ; }
Convert ELAPSED years/months/days of gregorian calendar to elapsed
 days in Gregorian epoch.
Convert ELAPSED years / months / days of gregorian calendar to elapsed days in Gregorian epoch .