calyearstart.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* All Rights Reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* calyearstart - determine the NTP time at midnight of January 1 in
* the year of the given date.
*/
#include "ntp_types.h"
#include "ntp_calendar.h"
#include "ntp_stdlib.h"
/*
* calyeartab - year start offsets from the beginning of a cycle
*/
};
register u_long dateinyear;
{
register u_long cyclestart;
register int i;
/*
* Find the start of the cycle this is in.
*/
if (dateinyear >= MAR1988)
else
/*
* If we're in the first year of the cycle, January 1 is
* two months back from the cyclestart and the year is
* a leap year.
*/
if (dateinyear < lastyear)
return (cyclestart - JANFEBLEAP);
/*
* Look for an intermediate year
*/
for (i = 1; i < YEARSPERCYCLE; i++) {
if (dateinyear < nextyear)
return lastyear;
}
/*
* Not found, must be in last two months of cycle
*/
return nextyear;
}