2 * caltontp - convert a date to an NTP time
7 #include "ntp_calendar.h"
8 #include "ntp_stdlib.h"
12 register const struct calendar *jt
15 u_long ace_days; /* absolute Christian Era days */
21 * First convert today's date to absolute days past 12/1/1 BC
23 prior_years = jt->year-1;
24 ace_days = jt->yearday /* days this year */
25 +(DAYSPERYEAR*prior_years) /* plus days in previous years */
26 +(prior_years/4) /* plus prior years's leap days */
27 -(prior_years/100) /* minus leapless century years */
28 +(prior_years/400); /* plus leapful Gregorian yrs */
31 * Subtract out 1/1/1900, the beginning of the NTP epoch
33 ntp_days = ace_days - DAY_NTP_STARTS;
39 ntp_days*SECSPERDAY+SECSPERMIN*(MINSPERHR*jt->hour + jt->minute);