FreeBSD/contrib/ntp/libntp/calyearstart.c
/*
 * Juergen Perlinger, 2010-05-02
 *
 * Redone in terms of the calendar functions. It's rather simple:
 * - expand the NTP time stamp
 * - split into days and seconds since midnight, dropping the partial day
 * - get full number of days before year start in NTP epoch
 * - convert to seconds, truncated to 32 bits.
 */
Juergen Perlinger, 2010-05-02
Redone in terms of the calendar functions. It's rather simple:
- expand the NTP time stamp
- split into days and seconds since midnight, dropping the partial day
- get full number of days before year start in NTP epoch
- convert to seconds, truncated to 32 bits.
Juergen Perlinger 2010 - 05 - 02 Redone in terms of the calendar functions . It ' s rather simple : - expand the NTP time stamp - split into days and seconds since midnight dropping the partial day - get full number of days before year start in NTP epoch - convert to seconds truncated to 32 bits .
u_int32
calyearstart(u_int32 ntptime, const time_t *pivot)
{
	u_int32      ndays; 
	vint64       vlong;
	ntpcal_split split;
	vlong = ntpcal_ntp_to_ntp(ntptime, pivot);
	split = ntpcal_daysplit(&vlong);
	ndays = ntpcal_rd_to_ystart(split.hi + DAY_NTP_STARTS)
	      - DAY_NTP_STARTS;
	return (u_int32)(ndays * SECSPERDAY);
}
u_int32 calyearstart ( u_int32 ntptime , const time_t * pivot ) { u_int32 ndays ; vint64 vlong ; ntpcal_split split ; vlong = ntpcal_ntp_to_ntp ( ntptime , pivot ) ; split = ntpcal_daysplit ( & vlong ) ; ndays = ntpcal_rd_to_ystart ( split . hi + DAY_NTP_STARTS ) - DAY_NTP_STARTS ; return ( u_int32 ) ( ndays * SECSPERDAY ) ; }
Juergen Perlinger, 2010-05-02
 Redone in terms of the calendar functions.
Juergen Perlinger 2010 - 05 - 02 Redone in terms of the calendar functions .
/* elapsed days since NTP starts */