make complete and don't overlap
[unix-history] / usr / src / include / tzfile.h
CommitLineData
6949fc73 1/*
47ae2e1a
KB
2 * Copyright (c) 1988 Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Arthur Olson.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the University of California, Berkeley. The name of the
14 * University may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * @(#)tzfile.h 5.3 (Berkeley) %G%
6949fc73
KB
21 */
22
23/*
24** Information about time zone files.
25*/
26
27#define TZDIR "/etc/zoneinfo" /* Time zone object file directory */
28#define TZDEFAULT "localtime"
29
30/*
31** Each file begins with. . .
32*/
33
34struct tzhead {
35 char tzh_reserved[32]; /* reserved for future use */
36 char tzh_timecnt[4]; /* coded number of transition times */
37 char tzh_typecnt[4]; /* coded number of local time types */
38 char tzh_charcnt[4]; /* coded number of abbr. chars */
39};
40
41/*
42** . . .followed by. . .
43**
44** tzh_timecnt (char [4])s coded transition times a la time(2)
45** tzh_timecnt (unsigned char)s types of local time starting at above
46** tzh_typecnt repetitions of
47** one (char [4]) coded GMT offset in seconds
48** one (unsigned char) used to set tm_isdt
49** one (unsigned char) that's an abbreviation list index
50** tzh_charcnt (char)s '\0'-terminated zone abbreviaton strings
51*/
52
53/*
54** In the current implementation, "tzset()" refuses to deal with files that
55** exceed any of the limits below.
56*/
57
58/*
59** The TZ_MAX_TIMES value below is enough to handle a bit more than a
60** year's worth of solar time (corrected daily to the nearest second) or
61** 138 years of Pacific Presidential Election time
62** (where there are three time zone transitions every fourth year).
63*/
64#define TZ_MAX_TIMES 370
65
66#define NOSOLAR /* We currently don't handle solar time */
67
68#ifndef NOSOLAR
69#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
70#else /* !NOSOLAR */
71#define TZ_MAX_TYPES 10 /* Maximum number of local time types */
72#endif /* !NOSOLAR */
73
74#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
75
76#define SECS_PER_MIN 60
77#define MINS_PER_HOUR 60
78#define HOURS_PER_DAY 24
79#define DAYS_PER_WEEK 7
80#define DAYS_PER_NYEAR 365
81#define DAYS_PER_LYEAR 366
82#define SECS_PER_HOUR (SECS_PER_MIN * MINS_PER_HOUR)
83#define SECS_PER_DAY ((long) SECS_PER_HOUR * HOURS_PER_DAY)
84#define MONS_PER_YEAR 12
85
86#define TM_SUNDAY 0
87#define TM_MONDAY 1
88#define TM_TUESDAY 2
89#define TM_WEDNESDAY 3
90#define TM_THURSDAY 4
91#define TM_FRIDAY 5
92#define TM_SATURDAY 6
93
94#define TM_JANUARY 0
95#define TM_FEBRUARY 1
96#define TM_MARCH 2
97#define TM_APRIL 3
98#define TM_MAY 4
99#define TM_JUNE 5
100#define TM_JULY 6
101#define TM_AUGUST 7
102#define TM_SEPTEMBER 8
103#define TM_OCTOBER 9
104#define TM_NOVEMBER 10
105#define TM_DECEMBER 11
106#define TM_SUNDAY 0
107
108#define TM_YEAR_BASE 1900
109
110#define EPOCH_YEAR 1970
111#define EPOCH_WDAY TM_THURSDAY
112
113/*
114** Accurate only for the past couple of centuries;
115** that will probably do.
116*/
117
118#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)