|
|
|
| Listing 4.1 dateinfo.h | |
|
|
|
|
/* dateinfo.h
+-------------------------------------------+
| Copyright (C) 1995 by Lance W. Latham. |
| All rights reserved. |
+-------------------------------------------+
Header file containing the definition of the DATE_INFO data structure,
an elementary and basic unit used in many SCDTL applications.
All variables are defined as type int. Year is defined as type int
for two reasons:
1. Dates in several calendars may use negative years, so that
a signed int is required, in general.
2. Due to precession and variation in the rate of rotation of the
Earth, the actual accuracy of a calendar is limited in practice,
so that an upper bound of 32767 years is entirely reasonable.
At the time of writing, not enough is known about non-Terran
planets to make this same determination.
Month and day are defined as type int for two reasons:
1. Consistency with year.
2. Greater number of native mathematical operations available for
type int than for type char, the range of which would be generally
adequate for these two units for most calendars. Both units are
often used as indices into arrays, and can be used 'straight',
without conversion, when represented as type int.
Also, the number of instances in which large numbers of these
units are stored internally is very small. For situations requiring
external storage of large numbers of these units, conversion to
type char may be considered.
*/
#ifndef __DATEINFO_H
#define __DATEINFO_H
struct DATE_INFO
{
int year;
int month;
int day;
};
#endif |
|
|
|
|
|
|
|