ntp_calendar.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* All Rights Reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ntp_calendar.h - definitions for the calendar time-of-day routine
*/
#ifndef NTP_CALENDAR_H
#define NTP_CALENDAR_H
#include "ntp_types.h"
struct calendar {
};
/*
* Days in each month. 30 days hath September...
*/
#define JAN 31
#define FEB 28
#define FEBLEAP 29
#define MAR 31
#define APR 30
#define MAY 31
#define JUN 30
#define JUL 31
#define AUG 31
#define SEP 30
#define OCT 31
#define NOV 30
#define DEC 31
/*
* We deal in a 4 year cycle starting at March 1, 1900. We assume
* we will only want to deal with dates since then, and not to exceed
* the rollover day in 2036.
*/
#define YEARSPERCYCLE 4
/*
* Gross hacks. I have illicit knowlege that there won't be overflows
* here, the compiler often can't tell this.
*/
/*
* Another big hack. Cycle 22 started on March 1, 1988. This is
* STARTCYCLE22 seconds after the start of cycle 0.
*/
#define CYCLE22 (22)
/*
* The length of January + February in leap and non-leap years.
*/
/*
* Additional support stuff for Ed Rheingold's calendrical calculations
*/
/*
* Start day of NTP time as days past the imaginary date 12/1/1 BC.
* (This is the beginning of the Christian Era, or BCE.)
*/
#define DAY_NTP_STARTS 693596
/*
* The Gregorian calendar is based on a 400 year cycle. This is the number
* of days in each cycle.
*/
#define GREGORIAN_CYCLE_DAYS 146097
/*
* Days in a normal 100 year leap year calendar. We lose a leap year day
* in years evenly divisible by 100 but not by 400.
*/
#define GREGORIAN_NORMAL_CENTURY_DAYS 36524
/*
* Days in a normal 4 year leap year calendar cycle.
*/
#define GREGORIAN_NORMAL_LEAP_CYCLE_DAYS 1461
#endif